node-flick.js revision 431adebef2d65f5c73809006d3f032ef98d25c27
var HOST = "host",
PARENT_NODE = "parentNode",
BOUNDING_BOX = "boundingBox",
OFFSET_HEIGHT = "offsetHeight",
OFFSET_WIDTH = "offsetWidth",
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 : {},
easing : {}
};
initializer : function() {
this.setBounds();
this._setStyles();
});
},
setBounds : function () {
if (contentHeight > boxHeight) {
this._minY = 0;
this._scrollY = true;
}
if (contentWidth > boxWidth) {
this._minX = 0;
this._scrollX = true;
}
},
_setStyles : 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._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;
},
// TODO: Integrate 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);
}
}
});