Permalink
Browse files

Fixed axis config

  • Loading branch information...
1 parent cffcc34 commit d50f0742f1c8f78087736849c0a4f37ec9d1f3f8 @derek committed Jul 2, 2012
Showing with 27 additions and 24 deletions.
  1. +7 −9 dualaxispaginator/index.html
  2. +10 −9 dualaxispaginator/paginator-plugin.js
  3. +10 −6 dualaxispaginator/scrollview-base.js
@@ -63,20 +63,18 @@
srcNode:"#content",
width:400,
height:300,
- axisX: true,
- axisY: true,
flick: {
minDistance:10,
minVelocity:0.3,
axis: 'y'
},
- plugins: [{
- fn:Y.Plugin.ScrollViewPaginator,
- cfg:{
- axis: 'x',
- selector:">ul>li"
- }
- }],
+ // plugins: [{
+ // fn:Y.Plugin.ScrollViewPaginator,
+ // cfg:{
+ // axis: 'x',
+ // selector:">ul>li"
+ // }
+ // }],
}).render();
scrollview.after(['scrollXChange', 'scrollYChange'], function(){
@@ -110,7 +110,7 @@ PaginatorPlugin.ATTRS = {
Y.extend(PaginatorPlugin, Y.Plugin.Base, {
- optimizeMemory: false,
+ optimizeMemory: true,
padding: 1,
_uiEnabled: true,
_prevent: new Y.Do.Prevent(),
@@ -317,7 +317,7 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
paginator.cards[index].scrollY = host.get('scrollY');
- // paginator._optimize();
+ paginator._optimize();
paginator._uiEnable();
},
@@ -364,10 +364,10 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
}
// Show the pages in/near the viewport & hide the rest
- pageNodes = paginator._getStage(currentIndex);
- paginator._showNodes(pageNodes.visible);
- paginator._hideNodes(pageNodes.hidden);
- // paginator.scrollToIndex(currentIndex, 0);
+ // pageNodes = paginator._getStage(currentIndex);
+ // paginator._showNodes(pageNodes.visible);
+ // paginator._hideNodes(pageNodes.hidden);
+ // host.scrollTo(currentIndex, 0);
},
/**
@@ -441,7 +441,7 @@ Y.extend(PaginatorPlugin, Y.Plugin.Base, {
*/
_uiEnable: function () {
var paginator = this;
-console.log('_uiEnable');
+// console.log('_uiEnable');
paginator._uiEnabled = true;
},
@@ -454,7 +454,7 @@ console.log('_uiEnable');
_uiDisable: function () {
var paginator = this;
-console.log('_uiDisable');
+// console.log('_uiDisable');
paginator._uiEnabled = false;
},
@@ -505,6 +505,7 @@ console.log('_uiDisable');
paginator.set(INDEX, target);
},
+ // For backwards compatibility
scrollTo: function () {
return this.scrollToIndex.apply(this, arguments);
},
@@ -548,7 +549,7 @@ console.log('_uiDisable');
scrollAxis = SCROLL_X;
scrollVal = pageNodes.item(index).get("offsetLeft");
}
-
+
host.set(scrollAxis, scrollVal, {
duration: duration,
easing: easing
@@ -556,9 +556,13 @@ Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
if (!this._cDisabled) {
var sv = this,
bb = sv._bb,
+ axisX = sv.get(AXIS_X),
+ axisY = sv.get(AXIS_Y);
currentX = sv.get(SCROLL_X),
currentY = sv.get(SCROLL_Y);
+ sv._cAxisX = axisX;
+ sv._cAxisY = axisY;
if (sv._prevent.start) {
e.preventDefault();
@@ -604,6 +608,8 @@ Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
var sv = this,
gesture = sv._gesture,
+ axisX = sv._cAxisX,
+ axisY = sv._cAxisY,
startX = gesture.startX,
startY = gesture.startY,
startClientX = gesture.startClientX,
@@ -623,11 +629,12 @@ Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y;
}
- if (gesture.axis == DIM_X) {
+ if (gesture.axis == DIM_X && sv._cAxisX) {
newX = startX + gesture.deltaX;
sv.set(SCROLL_X, newX);
}
- else {
+
+ if (gesture.axis == DIM_Y && sv._cAxisY) {
newY = startY + gesture.deltaY;
sv.set(SCROLL_Y, newY);
}
@@ -652,8 +659,7 @@ Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
if (sv._prevent.end) {
e.preventDefault();
}
-
-
+
gesture.endClientX = clientX;
gesture.endClientY = clientY;
@@ -668,8 +674,6 @@ Y.ScrollView = Y.extend(ScrollView, Y.Widget, {
sv._onTransEnd();
}
}
-
- return;
},
/**

0 comments on commit d50f074

Please sign in to comment.