cubiq/SwipeView

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:

Out of sync

Thanks!

Same issue as #18, with proposed fix applied to the latest repo here: #39

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.

Looks like #39 has not been merged into master yet. It would be great if it was merged, thanks!

the requested mod to #39 has not been applied... I'll work on this as soon as iScroll 5.1 is ready