node-flick.js revision 2466a85bbf5c70a4a157bd8c4a0ac51de447133d
var HOST = "host",
PARENT_NODE = "parentNode",
BOUNDING_BOX = "boundingBox",
OFFSET_HEIGHT = "offsetHeight",
OFFSET_WIDTH = "offsetWidth",
SCROLL_HEIGHT = "scrollHeight",
SCROLL_WIDTH = "scrollWidth",
BOUNCE = "bounce",
MIN_DISTANCE = "minDistance",
MIN_VELOCITY = "minVelocity",
BOUNCE_DISTANCE = "bounceDistance",
DECELERATION = "deceleration",
STEP = "step",
DURATION = "duration",
EASING = "easing",
FLICK = "flick",
}
deceleration : {
value: 0.98
},
bounce : {
value: 0.7
},
bounceDistance : {
value: 150
},
minVelocity : {
value: 0
},
minDistance : {
value: 10
},
boundingBox : {
valueFn : function() {
}
},
step : {
value:10
},
duration : {
value:null
},
easing : {
value:null
}
};
initializer : function() {
this._renderClasses();
this.setBounds();
});
},
setBounds : function () {
if (contentHeight > boxHeight) {
this._minY = 0;
this._scrollY = true;
}
if (contentWidth > boxWidth) {
this._minX = 0;
this._scrollX = true;
}
},
_renderClasses : function() {
},
/**
* Execute a flick at the end of a scroll action
*
* @method _flick
* @param distance {Number} The distance (in px) the user scrolled before the flick
* @param time {Number} The number of ms the scroll event lasted before the flick
* @protected
*/
_onFlick: function(e) {
this._flick = true;
this._flickAnim();
},
/**
* Execute a single frame in the flick animation
*
* @method _flickFrame
* @protected
*/
_flickAnim: function() {
var y = this._y,
x = this._x,
if (this._scrollX) {
}
if (this._scrollY) {
}
this._flick = false;
if (this._scrollX) {
if (x < minX) {
this._snapToEdge = true;
} else if (x > maxX) {
this._snapToEdge = true;
}
}
if (this._scrollY) {
if (y < minY) {
this._snapToEdge = true;
} else if (y > maxY) {
this._snapToEdge = true;
}
}
} else {
this._exceededXBoundary = true;
}
this._exceededYBoundary = true;
}
if (this._scrollX) {
this._setX(x);
}
if (this._scrollY) {
this._setY(y);
}
}
},
},
},
if (x !== null) {
x = this._bounce(x);
} else {
x = this._x;
}
if (y !== null) {
y = this._bounce(y);
} else {
y = this._y;
}
this._x = x;
this._y = y;
},
var xn = x * -1,
yn = y * -1,
transition = {
};
if (Y.TransitionNative.supported) {
} else {
}
},
if(!bounce) {
}
}
return val;
},
/**
* Stop the animation timer
*
* @method _killTimer
* @param fireEvent {Boolean} If true, fire the scrollEnd event
* @private
*/
_killTimer: function(fireEvent) {
if(this._flickTimer) {
this._flickTimer.cancel();
}
}
}, {
VELOCITY_THRESHOLD : 0.015,
SNAP_DURATION : 400,
SNAP_EASING : 'ease-out',
CLASS_NAMES : {
}
});