cubiq / SwipeView

Virtually infinite loop-able horizontal carousel
MIT License
698 stars 167 forks source link

Page indices go out of sync if dragged past threshold and back #38

Open kpuputti opened 12 years ago

kpuputti commented 12 years ago

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!

kpuputti commented 12 years ago

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

cubiq commented 12 years ago

kudos just for the linux screenshot. I'll look into it. It must be a very stupid bug

jhnns commented 11 years ago

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;
));
jhnns commented 11 years ago

This works only if loop is false of course.

zthomas commented 10 years ago

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

cubiq commented 10 years ago

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