Skip to content

Commit

Permalink
Fixing a bug where a FlipView with >50 items can't be panned from the…
Browse files Browse the repository at this point in the history
… last item all the way to first item

The problem was that we were only recentering items in the scrollable
area when the next/previous buttons were being pressed, and not when the
user is using touch manipulation.  The fix is simple: we ensure that
we're always recentering items once we've come to a snap point when
using touch manipulation.
  • Loading branch information
llongley committed Oct 12, 2016
1 parent e0ad943 commit 89d8955
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/js/WinJS/Controls/FlipView/_PageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,25 +282,34 @@ define([
return;
}

while (this._currentPage.element && this._getItemStart(this._currentPage) > newPos && this._currentPage.prev.element) {
var movedPages = false;

while (this._currentPage.element && this._currentPage.prev && this._currentPage.prev.element && newPos <= this._getItemStart(this._currentPage.prev)) {
this._currentPage = this._currentPage.prev;
this._fetchOnePrevious(bufferEnd.prev);
bufferEnd = bufferEnd.prev;
movedPages = true;
}

while (this._currentPage.element && this._itemEnd(this._currentPage) <= newPos && this._currentPage.next.element) {
while (this._currentPage.element && this._currentPage.next && this._currentPage.next.element && newPos >= this._getItemStart(this._currentPage.next)) {
this._currentPage = this._currentPage.next;
this._fetchOneNext(bufferEnd.next);
bufferEnd = bufferEnd.next;
movedPages = true;
}

this._setButtonStates();
this._checkElementVisibility(false);
this._blockTabs = true;
this._lastScrollPos = newPos;

if (this._currentPage.element) {
this._tabManager.childFocus = this._currentPage.element;
}
this._setListEnds();

if (movedPages) {
this._ensureCentered(true);
}

if (!this._manipulationState && this._viewportOnItemStart()) {
// Setup a timeout to invoke _itemSettledOn in cases where the scroll position is changed, and the control
Expand Down

0 comments on commit 89d8955

Please sign in to comment.