scrollview-base.js revision ad6e346a6f9cbbb0abfca67d0a94e695408b751e
0N/A * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators 0N/A * @module scrollview-base 0N/A * ScrollView provides a scrollable widget, supporting flick gestures, across both touch and mouse based devices. 0N/A * @param config {Object} Object literal with initial attribute values 0N/A // Y.ScrollView prototype 0N/A * Designated initializer 0N/A * @method initializer 0N/A // Cache - they're write once, and not going to change 0N/A * Publishes events which occur during the scroll lifecycle 0N/A * @method _createEvents 0N/A * Notification event fired at the end of a scroll transition 0N/A * @param e {EventFacade} The default event facade. 0N/A * Notification event fired at the end of a flick gesture (the flick animation may still be in progress) 0N/A * @param e {EventFacade} The default event facade. 0N/A * Override the contentBox sizing method, since the contentBox height 0N/A * should not be that of the boundingBox. 0N/A * TranstionEnd event handler 0N/A * @method _transitionEnded 0N/A * @param {Event.Facade} e The event facade 0N/A * bindUI implementation 0N/A * Hooks up events for the widget 0N/A // TODO: Fires way to often when using non-native transitions, due to property change 0N/A 'renderedChange':
function() { Y.
later(
0,
this,
'_uiDimensionsChange'); }
* Update the scroll position, based on the current value of scrollY * Scroll the element to a given y coordinate * @param x {Number} The x-position to scroll to * @param y {Number} The y-position to scroll to * @param duration {Number} Duration, in ms, of the scroll animation (default is 0) * @param easing {String} An easing equation if duration is set * gesturemovestart event handler * @method _onGestureMoveStart * @param e {Event.Facade} The gesturemovestart event facade * Internal state, defines whether or not the scrollview is currently being dragged * Internal state, defines whether or not the scrollview is currently animating a flick * Internal state, defines whether or not the scrollview needs to snap to a boundary edge * gesturemove event handler * @param e {Event.Facade} The gesturemove event facade * gestureend event handler * @method _onGestureMoveEnd * @param e {Event.Facade} The gesturemoveend event facade * Internal state, defines whether or not the scrollview has been scrolled half it's width/height * @property _scrolledHalfway * Internal state, defines whether or not the scrollview has been scrolled in the forward (distance > 0), or backward (distance < 0) direction * @property _scrolledForward * After listener for changes to the scrollY attribute * @method _afterScrollYChange * @param e {Event.Facade} The event facade * Update the UI when the scrollY attribute changes * @param val {Number} The scrollY value * @param duration {Number} The length (in ms) of the scroll animation * @param easing {String} An easing equation, if duration is defined * After listener for changes to the scrollX attribute * @method _afterScrollXChange * @param e {Event.Facade} The event facade * Update the UI when the scrollX attribute changes * @param val {Number} The scrollX value * @param duration {Number} The length (in ms) of the scroll animation * @param easing {String} An easing equation, if duration is defined * After listener for the height attribute * @method _afterHeightChange * @param e {Event.Facade} The event facade * After listener for the width attribute * @method _afterWidthChange * @param e {Event.Facade} The event facade * This method gets invoked whenever the height or width attributes change, * allowing us to determine which scrolling axes need to be enabled. * @method _uiDimensionsChange // Use bb instead of cb. cb doesn't gives us the right results // in FF (due to overflow:hidden) * Internal state, defines whether or not the scrollview can scroll vertically * @property _scrollsVertical * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis * Internal state, cached scrollHeight, for performance * @property _scrollHeight * Internal state, defines whether or not the scrollview can scroll horizontally * @property _scrollsHorizontal * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis * Internal state, cached scrollWidth, for performance * Execute a flick at the end of a scroll action * @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 * Internal state, currently calculated velocity from the flick * @property _currentVelocity * Execute a single frame in the flick animation * Stop the animation timer * @param fireEvent {Boolean} If true, fire the scrollEnd event * The scrollX, scrollY setter implementation * @return {Number} The constrained value, if it exceeds min/max range * Setter for the scrollX attribute * @param val {Number} The new scrollX value * @return {Number} The normalized value * Setter for the scrollY ATTR * @param val {Number} The new scrollY value * @return {Number} The normalized value // Y.ScrollView static properties * The identity of the widget. * @property ScrollView.NAME * Static property used to define the default attribute configuration of * @property ScrollView.ATTRS * The scroll position in the y-axis * The scroll position in the x-axis * Drag coefficent for inertial scrolling. The closer to 1 this * value is, the less friction during scrolling. * @attribute deceleration * Drag coefficient for intertial scrolling at the upper * and lower boundaries of the scrollview. Set to 0 to * disable "rubber-banding". * The minimum distance and/or velocity which define a flick * @default Object with properties minDistance = 10, minVelocity = 0.3. * List of class names used in the scrollview's DOM * @property ScrollView.CLASS_NAMES * Flag used to source property changes initiated from the DOM * @property ScrollView.UI_SRC * The default bounce distance in pixels * @property ScrollView.BOUNCE_RANGE * The step amount used when animating the flick * @property ScrollView.FRAME_STEP * The default easing used when animating the flick * @property ScrollView.EASING * @default 'cubic-bezier(0, 0.1, 0, 1.0)' EASING :
'cubic-bezier(0, 0.1, 0, 1.0)',
* The default easing to use when animatiing the bounce snap back. * @property ScrollView.SNAP_EASING },
'@VERSION@' ,{
skinnable:
true,
requires:[
'widget',
'event-gestures',
'transition']});