scrollview-base-debug.js revision 6e2ec7ffae3abc29274a143e4dba51bbd349c58d
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @module scrollview-base
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glassvar getClassName = Y.ClassNameManager.getClassName,
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * ScrollView provides a scrollable widget, supporting flick gestures, across both touch and mouse based devices.
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @class ScrollView
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @namespace
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @param config {Object} Object literal with initial attribute values
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @extends Widget
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @constructor
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass ScrollView.superclass.constructor.apply(this, arguments);
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass // Y.ScrollView prototype
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Designated initializer
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @method initializer
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass initializer: function() {
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass // Cache - they're write once, and not going to change
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Publishes events which occur during the scroll lifecycle
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @method _createEvents
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Notification event fired at the end of a scroll transition
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @event scrollEnd
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @param e {EventFacade} The default event facade.
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Notification event fired at the end of a flick gesture (the flick animation may still be in progress)
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @event flick
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @param e {EventFacade} The default event facade.
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Override the contentBox sizing method, since the contentBox height
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * should not be that of the boundingBox.
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @method _uiSizeCB
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @protected
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass _uiSizeCB: function() {},
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * TranstionEnd event handler
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @method _transitionEnded
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @param {Event.Facade} e The event facade
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * bindUI implementation
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * Hooks up events for the widget
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass * @method bindUI
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass bindUI: function() {
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass this._bb.on('gesturemovestart', Y.bind(this._onGestureMoveStart, this));
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass cb.on('transition:end', Y.bind(this._transitionEnded, this), false);
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass // TODO: Fires way to often when using non-native transitions, due to property change
ae3b364068d9a32a9c7a81fd9530d90496943d45Dav Glass cb.on('DOMSubtreeModified', Y.bind(this._uiDimensionsChange, this));
syncUI: function() {
xSet = (x !== null),
ySet = (y !== null),
if (xSet) {
if (ySet) {
transition = {
if (NATIVE_TRANSITIONS) {
if (NATIVE_TRANSITIONS) {
_onGestureMoveStart: function(e) {
e.preventDefault();
this._killTimer();
this._isDragging = false;
this._flicking = false;
this._snapToEdge = false;
_onGestureMove: function(e) {
e.preventDefault();
this._isDragging = true;
if(this._scrollsVertical) {
if(this._scrollsHorizontal) {
_onGestureMoveEnd: function(e) {
e.preventDefault();
this._scrolledHalfway = false;
this._snapToEdge = false;
this._isDragging = false;
this._scrolledHalfway = true;
this._scrolledHalfway = true;
this._snapToEdge = true;
this._snapToEdge = true;
this._snapToEdge = true;
this._snapToEdge = true;
if(this._snapToEdge) {
onGestureMoveEnd: true
_afterScrollYChange : function(e) {
_afterScrollXChange : function(e) {
_afterHeightChange: function() {
this._uiDimensionsChange();
_afterWidthChange: function() {
this._uiDimensionsChange();
_uiDimensionsChange: function() {
this._scrollsVertical = true;
this._scrollsHorizontal = true;
_flick: function(e) {
this._flicking = true;
this._pastYEdge = false;
this._pastXEdge = false;
this._flickFrame();
_flickFrame: function() {
var newY,
maxY,
minY,
newX,
maxX,
minX,
if(scrollsVertical) {
if(scrollsHorizontal) {
this._flicking = false;
if(scrollsVertical) {
this._snapToEdge = true;
this._snapToEdge = true;
if(scrollsHorizontal) {
this._snapToEdge = true;
this._snapToEdge = true;
if (scrollsVertical) {
this._pastYEdge = true;
if (scrollsHorizontal) {
this._pastXEdge = true;
if (!this._flickTimer) {
if(this._flickTimer) {
this._flickTimer = null;
if(fireEvent) {
return val;
ATTRS: {
scrollY: {
scrollX: {
deceleration: {
bounce: {
flick: {
value: {