Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ScrollViewPaginator partial transition #1816

Open
mairatma opened this issue May 13, 2014 · 1 comment
Open

ScrollViewPaginator partial transition #1816

mairatma opened this issue May 13, 2014 · 1 comment

Comments

@mairatma
Copy link
Contributor

I've started using ScrollViewPaginator for a project and I noticed this problem on horizontal scroll views with the paginator. To see it happening, just open the offical demo page (http://yuilibrary.com/yui/docs/scrollview/scrollview-paging-example.html) and make a diagonal drag (from top right to bottom left). You'll see that the scrollbar will move to the next image but the image showing up will still be the one that was showing before the drag.

I've investigated a little and I believe that the problem is inside paginator-plugin.js's _beforeHostFlick method. It prevents calls to _flick but simulates them on the background, moving to the next/previous index and calling scrollTo in the end. The diagonal drag is being identified by scrollview-base.js as a flick on the y axis though, which would normally be ignored inside the _flick method if it was not being prevented and simulated by the paginator. The _beforeHostFlick method doesn't check if the gesture's axis matches the allowed flick axis though, and simulates it anyway, moving to the next index but without scrolling to it since the gesture didn't cause a scroll on the x axis.

I've verified that this is fixed by just checking if the gesture axis is the same as the flick axis inside _beforeHostFlick, but I'm not sure if that's the best fix. Maybe a diagonal drag should also be considered as a horizontal flick instead of just vertical. I can organize what I have and send it later when I have some time if this isn't fixed by then though.

@triptych
Copy link
Contributor

Please feel free to get a PR started, and I'll help get the right eyes on it for review.

mairatma added a commit to mairatma/yui3 that referenced this issue May 16, 2014
This is fixing the issue described in yui#1816, which causes diagonal flicks to change the paginator's index even though the image showing up is not updated.
To fix this I'm just adding one more check to _beforeHostFlick to ignore flicks that don't happen in the specified flick axis. This is the default behavior of scrollview-base, but paginator-plugin prevents it and runs its own code, so we need the check there as well.
mairatma added a commit to mairatma/yui3 that referenced this issue May 16, 2014
This is fixing the issue described in yui#1816, which causes diagonal flicks to change the paginator's index even though the image showing up is not updated.
To fix this I'm just adding one more check to _beforeHostFlick to ignore flicks that don't happen in the specified flick axis. This is the default behavior of scrollview-base, but paginator-plugin prevents it and runs its own code, so we need the check there as well.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants