node-flick.js revision 2d6dc2a0e10bdba75ae44aa511c00d3f2b5cb4ff
//TODO
// Is offsetLeft, offsetTop accurate with translate
}
deceleration : {
value: 0.98
},
bounce : {
value: 0.7
},
bounceDistance : {
value: 150
},
minVelocity : {
value: 0
},
minDistance : {
value: 10
},
boundingBox : {
valueFn : function() {
}
},
step : {
value:10
},
duration : {},
easing : {}
};
initializer : function() {
this.setBounds();
this._uiSetStyle();
},
setBounds : function () {
if(contentHeight > boundingHeight) {
this._minY = 0;
this._scrollY = true;
}
if (contentWidth > boundingWidth) {
this._minX = 0;
this._scrollX = true;
}
},
_uiSetStyle : function() {
// TODO: Cross-browser and class based
}
},
/**
* 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._flicking = true;
this._move();
},
/**
* Execute a single frame in the flick animation
*
* @method _flickFrame
* @protected
*/
_move: function() {
var // content = this.get("host"),
y = this._y, //content.get("offsetTop"),
x = this._x, //content.get("offsetLeft"),
if(this._scrollX) {
}
if(this._scrollY) {
}
this._flicking = false;
// TODO
if(this._scrollX) {
if(x < minX) {
this._snapToEdge = true;
this._setOffsetX(minX);
} else if(x > maxX) {
this._snapToEdge = true;
this._setOffsetX(maxX);
}
}
if(this._scrollY) {
if(y < minY) {
this._snapToEdge = true;
this._setOffsetY(minY);
} else if(y > maxY) {
this._snapToEdge = true;
this._setOffsetY(maxY);
}
}
} else {
this._exceededXBoundary = true;
}
this._exceededYBoundary = true;
}
if(this._scrollX) {
this._setOffsetX(x);
}
if(this._scrollY) {
this._setOffsetY(y);
}
}
},
_setOffsetX : function(val) {
},
_setOffsetY : function(val) {
},
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;
},
// TODO: Anim, once done
if(duration) {
} 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();
}
if(fireEvent) {
// this.fire(EV_SCROLL_END);
}
}
});