Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix #1816: ScrollViewPaginator partial transition #1823

Open
wants to merge 1 commit into
base: dev-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/scrollview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ ScrollView Change History
@VERSION@
------

* No changes.
* [#1816][]: ScrollViewPaginator partial transition (@mairatma)

[#1816]: https://github.com/yui/yui3/issues/1816

3.16.0
------
Expand Down
7 changes: 6 additions & 1 deletion src/scrollview/js/paginator-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,13 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
canScroll = paginatorAxis[flickAxis],
rtl = host.rtl;

// Store the flick data in the this._host._gesture object so it knows this was a flick
if (gesture) {
// The gesture axis is not the flick axis, so do nothing
if (gesture.axis !== flickAxis) {
return new Y.Do.Prevent();
}

// Store the flick data in the this._host._gesture object so it knows this was a flick
gesture.flick = flick;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,26 @@ YUI.add('scrollview-paginator-unit-tests', function (Y, NAME) {
Y.Assert.isInstanceOf(Y.Do.Prevent, response);
},

"Flicks on the opposite axis should be prevented": function() {
var Test = this,
scrollview = this.scrollview,
paginator = scrollview.pages,
mockEvent = this.mockEvent,
response;

scrollview._gesture = {axis: 'y'};
response = paginator._beforeHostFlick(mockEvent);
Y.Assert.isInstanceOf(Y.Do.Prevent, response);
},

"Flick right should advance the page" : function () {
var Test = this,
scrollview = this.scrollview,
paginator = scrollview.pages,
mockEvent = this.mockEvent,
response;

scrollview._gesture = true;
scrollview._gesture = {axis: 'x'};

response = paginator._beforeHostFlick(mockEvent);
Y.Assert.areEqual(1, paginator.get('index'));
Expand Down