Page indices go out of sync if dragged past threshold and back
kpuputti opened this issue · 6 comments
Can be reproduced in the project demo:
http://cubiq.org/dropbox/SwipeView/demo/gallery/
It take a few attempts, but if you drag the view past the threshold, then drag back just below the threshold (not all the way back), the page indices are updated but the shown view is still the same and is out of sync e.g. with the top indicators. I can already reproduce this every time and in our app this happens all the time by accident.
See screenshot, where the first image of the feed is shown, but the swipe indicator on the top highlights the last item:
Thanks!
kudos just for the linux screenshot. I'll look into it. It must be a very stupid bug
One possible workaround for this is (probably):
var previousPageIndex = gallery.pageIndex;
gallery.onFlip(function () {
if (Math.abs(gallery.pageIndex - previousPageIndex) > 1) {
gallery.goToPage(previousPageIndex);
return;
}
previousPageIndex = gallery.pageIndex;
));
This works only if loop is false of course.