scrollview-base.js revision d941a86bd2b332d492006f5ba5e4ba7c61cf989b
b450d7a1747c5f4fb7c917a8ec1f9ce8440d7ffevboxsync * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @module scrollview-base
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * ScrollView provides a scrollable widget, supporting flick gestures, across both touch and mouse based devices.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @class ScrollView
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @namespace
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param config {Object} Object literal with initial attribute values
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @extends Widget
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @constructor
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync ScrollView.superclass.constructor.apply(this, arguments);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Y.ScrollView prototype
6a795f9e75e30c7f1d75cd45e5de233c71662f58vboxsync * Designated initializer
6a795f9e75e30c7f1d75cd45e5de233c71662f58vboxsync * @method initializer
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync initializer: function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Cache - they're write once, and not going to change
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Publishes events which occur during the scroll lifecycle
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _createEvents
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Notification event fired at the end of a scroll transition
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @event scrollEnd
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {EventFacade} The default event facade.
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * Notification event fired at the end of a flick gesture (the flick animation may still be in progress)
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * @event flick
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * @param e {EventFacade} The default event facade.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Override the contentBox sizing method, since the contentBox height
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * should not be that of the boundingBox.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _uiSizeCB
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _uiSizeCB: function() {},
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Content box transition callback
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _transitionEnded
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param {Event.Facade} e The event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _transitionEnded: function(e) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * bindUI implementation
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Hooks up events for the widget
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method bindUI
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync bindUI: function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync bb.on('gesturemovestart', Y.bind(this._onGestureMoveStart, this));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._nativeBody = Y.Node.getDOMNode(Y.one("body", cb.get("ownerDocument")));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._selectstart = this._nativeBody.onselectstart;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._nativeBody.onselectstart = this._iePreventSelect;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._cbDoc.once(MOUSE_UP, this._ieRestoreSelect, this);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // TODO: Fires way to often when using non-native transitions, due to property change
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync cb.on('DOMSubtreeModified', Y.bind(this._uiDimensionsChange, this));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync 'renderedChange': function() { Y.later(0, this, '_uiDimensionsChange'); }
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * syncUI implementation
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Update the scroll position, based on the current value of scrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method bindUI
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync syncUI: function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this.scrollTo(this.get(SCROLL_X), this.get(SCROLL_Y));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Scroll the element to a given y coordinate
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method scrollTo
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param x {Number} The x-position to scroll to
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param y {Number} The y-position to scroll to
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param duration {Number} Duration, in ms, of the scroll animation (default is 0)
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param easing {String} An easing equation if duration is set
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync xSet = (x !== null),
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync ySet = (y !== null),
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // ANDROID WORKAROUND - try and stop existing transition, before kicking off new one.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync cb.setStyle(ScrollView._TRANSITION_DURATION, ZERO);
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync cb.setStyle(ScrollView._TRANSITION_PROPERTY, EMPTY);
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync // Causes bounce back from 0,0 instead of current translation for bottom/right edge animation
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync // cb.setStyle("WebkitTransform", cb.getComputedStyle("WebkitTransform"));
824104c3b60b9c8d5c03c40658e33ecd6c4fa9e8vboxsync transition.transform = 'translate3D('+ xMove +'px,'+ yMove +'px, 0px)';
824104c3b60b9c8d5c03c40658e33ecd6c4fa9e8vboxsync callback = this._transEndCallback = Y.bind(this._transitionEnded, this);
824104c3b60b9c8d5c03c40658e33ecd6c4fa9e8vboxsync cb.setStyle('transform', 'translate3D('+ xMove +'px,'+ yMove +'px, 0px)');
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Native onselectstart handle to prevent selection in IE
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _iePreventSelect
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _iePreventSelect : function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync return false;
824104c3b60b9c8d5c03c40658e33ecd6c4fa9e8vboxsync * Restores native onselectstart handle, backed up to prevent selection in IE
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _ieRestoreSelect
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _ieRestoreSelect : function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._nativeBody.onselectstart = this._selectstart;
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync * gesturemovestart event handler
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync * @method _onGestureMoveStart
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync * @param e {Event.Facade} The gesturemovestart event facade
b28326220af580dde4a61f15930f51fe584dc896vboxsync this._moveEvt = bb.on('gesturemove', Y.bind(this._onGestureMove, this));
b28326220af580dde4a61f15930f51fe584dc896vboxsync this._moveEndEvt = bb.on('gesturemoveend', Y.bind(this._onGestureMoveEnd, this));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._moveStartClientY = this._moveEndClientY = e.clientY;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._moveStartClientX = this._moveEndClientX = e.clientX;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview is currently being dragged
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _isDragging
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._isDragging = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview is currently animating a flick
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @property _flicking
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @type boolean
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @protected
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync this._flicking = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview needs to snap to a boundary edge
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _snapToEdge
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._snapToEdge = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * gesturemove event handler
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _onGestureMove
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {Event.Facade} The gesturemove event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _onGestureMove: function(e) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this.set(SCROLL_Y, -(e.clientY - this._moveStartY));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this.set(SCROLL_X, -(e.clientX - this._moveStartX));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * gestureend event handler
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _onGestureMoveEnd
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {Event.Facade} The gesturemoveend event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync startPoint = this._scrollsVertical ? this._moveStartClientY : this._moveStartClientX,
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync endPoint = this._scrollsVertical ? this._moveEndClientY : this._moveEndClientX,
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview has been scrolled half it's width/height
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _scrolledHalfway
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._snapToEdge = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._isDragging = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Contains the distance (postive or negative) in pixels by which the scrollview was last scrolled. This is useful when
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * setting up click listeners on the scrollview content, which on mouse based devices are always fired, even after a
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * <p>Touch based devices don't currently fire a click event, if the finger has been moved (beyond a threshold) so this check isn't required,
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * if working in a purely touch based environment</p>
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property lastScrolledAmt
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync if(this._scrollsHorizontal && Math.abs(distance) > (this.get('width')/2)) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview has been scrolled in the forward (distance > 0), or backward (distance < 0) direction
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _scrolledForward
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync if(this._scrollsVertical && Math.abs(distance) > (this.get('height')/2)) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Check for minY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync if(this._scrollsVertical && this.get(SCROLL_Y) < minY) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Check for minX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync if(this._scrollsHorizontal && this.get(SCROLL_X) < minX) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Check for maxY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Check for maxX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * After listener for changes to the scrollY attribute
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _afterScrollYChange
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {Event.Facade} The event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
6da7ae3144a7be1443dd37052b24370bf210fda1vboxsync _afterScrollYChange : function(e) {
493189f09538207d222d646e7ddc76adb3c438eevboxsync * Update the UI when the scrollY attribute changes
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _uiScrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param val {Number} The scrollY value
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param duration {Number} The length (in ms) of the scroll animation
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param easing {String} An easing equation, if duration is defined
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync easing = easing || this._snapToEdge ? ScrollView.SNAP_EASING : null;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * After listener for changes to the scrollX attribute
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _afterScrollXChange
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {Event.Facade} The event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _afterScrollXChange : function(e) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Update the UI when the scrollX attribute changes
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _uiScrollX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param val {Number} The scrollX value
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * @param duration {Number} The length (in ms) of the scroll animation
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * @param easing {String} An easing equation, if duration is defined
75ef08b33f9c67a8dd50748ece1117aed8098d51vboxsync * @protected
8f8c8ff0bfe182cff047f8c028b2546b25087d44vboxsync easing = easing || this._snapToEdge ? ScrollView.SNAP_EASING : null;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * After listener for the height attribute
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _afterHeightChange
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @param e {Event.Facade} The event facade
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * After listener for the width attribute
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _afterWidthChange
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param e {Event.Facade} The event facade
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * This method gets invoked whenever the height or width attributes change,
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * allowing us to determine which scrolling axes need to be enabled.
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @method _uiDimensionsChange
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Use bb instead of cb. cb doesn't gives us the right results
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // in FF (due to overflow:hidden)
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview can scroll vertically
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _scrollsVertical
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _maxScrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _minScrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, cached scrollHeight, for performance
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _scrollHeight
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines whether or not the scrollview can scroll horizontally
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _scrollsHorizontal
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type boolean
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _maxScrollX
8b82f5ce032cb07de31804c998483b0988530aebvboxsync * @type number
8b82f5ce032cb07de31804c998483b0988530aebvboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property _minScrollX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, cached scrollWidth, for performance
9083f76e8c5709604766d0215a380de516e781eevboxsync * @property _scrollWidth
9083f76e8c5709604766d0215a380de516e781eevboxsync * @type number
ad8fb8c920c36650d5ead020ef8e05b681dd4375vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Execute a flick at the end of a scroll action
ad8fb8c920c36650d5ead020ef8e05b681dd4375vboxsync * @method _flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param distance {Number} The distance (in px) the user scrolled before the flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param time {Number} The number of ms the scroll event lasted before the flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _flick: function(e) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Internal state, currently calculated velocity from the flick
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @property _currentVelocity
ee4d840f54fd2dcea8a73b1b86d5ec0db370b05dvboxsync * @type number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._pastYEdge = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._pastXEdge = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Execute a single frame in the flick animation
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _flickFrame
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync _flickFrame: function() {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync newY = this.get(SCROLL_Y) - (this._currentVelocity * step);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync newX = this.get(SCROLL_X) - (this._currentVelocity * step);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._currentVelocity = (this._currentVelocity * deceleration);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync if(Math.abs(this._currentVelocity).toFixed(4) <= 0.015) {
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._flicking = false;
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._killTimer(!(this._pastYEdge || this._pastXEdge));
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync this._flickTimer = Y.later(step, this, '_flickFrame', null, true);
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Stop the animation timer
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _killTimer
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param fireEvent {Boolean} If true, fire the scrollEnd event
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The scrollX, scrollY setter implementation
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _setScroll
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param {Number} val
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param {String} dim
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @return {Number} The constrained value, if it exceeds min/max range
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync var bouncing = this._cachedBounce || this.get(BOUNCE),
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync maxScroll = (dim == DIM_X) ? this._maxScrollX : this._maxScrollY,
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Setter for the scrollX attribute
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _setScrollX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param val {Number} The new scrollX value
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @return {Number} The normalized value
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Setter for the scrollY ATTR
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @method _setScrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @param val {Number} The new scrollY value
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @return {Number} The normalized value
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync // Y.ScrollView static properties
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The identity of the widget.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.NAME
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type String
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 'scrollview'
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @readOnly
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Static property used to define the default attribute configuration of
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * the Widget.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.ATTRS
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type {Object}
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @protected
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The scroll position in the y-axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @attribute scrollY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 0
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The scroll position in the x-axis
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @attribute scrollX
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 0
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Drag coefficent for inertial scrolling. The closer to 1 this
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * value is, the less friction during scrolling.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @attribute deceleration
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 0.93
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync * Drag coefficient for intertial scrolling at the upper
4946f90c5c7016131555f0c925091d4ede6bdde0vboxsync * and lower boundaries of the scrollview. Set to 0 to
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * disable "rubber-banding".
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @attribute bounce
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 0.1
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The minimum distance and/or velocity which define a flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @attribute flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Object
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default Object with properties minDistance = 10, minVelocity = 0.3.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * List of class names used in the scrollview's DOM
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.CLASS_NAMES
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Object
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Flag used to source property changes initiated from the DOM
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.UI_SRC
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type String
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default "ui"
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The default bounce distance in pixels
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.BOUNCE_RANGE
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 150
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The interval used when animating the flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.FRAME_STEP
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type Number
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 30
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The default easing used when animating the flick
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.EASING
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type String
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 'cubic-bezier(0, 0.1, 0, 1.0)'
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * The default easing to use when animatiing the bounce snap back.
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView.SNAP_EASING
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @type String
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @default 'ease-out'
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Style property name to use to set transition duration. Currently Webkit specific (WebkitTransitionDuration)
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView._TRANSITION_DURATION
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * Style property name to use to set transition property. Currently, Webkit specific (WebkitTransitionProperty)
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync * @property ScrollView._TRANSITION_PROPERTY
9dca051a5f8ff457ef1692990f6ecfa280daf265vboxsync}, '@VERSION@' ,{skinnable:true, requires:['widget', 'event-gestures', 'transition']});