scrollbars-plugin.js revision cc438feb3ca2316f1b8ece51eed4ae6eabe5b61d
/**
* Provides a plugin, which adds support for a scroll indicator to ScrollView instances
*
* @module scrollview-scrollbars
*/
SCROLLBAR = 'scrollbar',
SCROLLVIEW = 'scrollview';
/**
* ScrollView plugin that adds scroll indicators to ScrollView instances
*
* @class ScrollViewScrollbars
* @namespace Plugin
* @extends Plugin.Base
* @constructor
*/
function ScrollbarsPlugin() {
}
};
/**
* The identity of the plugin
*
* @property ScrollViewScrollbars.NAME
* @type String
* @default 'scrollbars-plugin'
* @static
*/
/**
* The namespace on which the plugin will reside.
*
* @property ScrollViewScrollbars.NS
* @type String
* @default 'scrollbars'
* @static
*/
/**
* HTML template for the scrollbar
*
* @property ScrollViewScrollbars.SCROLLBAR_TEMPLATE
* @type Object
* @static
*/
'<div>',
'</div>'
].join('');
/**
* The default attribute configuration for the plugin
*
* @property ScrollViewScrollbars.ATTRS
* @type Object
* @static
*/
/**
* Vertical scrollbar node
*
* @attribute verticalNode
* @type Y.Node
*/
verticalNode: {
setter: '_setVerticalNode',
},
/**
* Horizontal scrollbar node
*
* @attribute horizontalNode
* @type Y.Node
*/
setter: '_setHorizontalNode',
}
};
/**
* Designated initializer
*
* @method initializer
*/
initializer: function() {
},
/**
* Set up the DOM nodes for the scrollbars. This method is invoked whenver the
* host's _uiDimensionsChange fires, giving us the opportunity to remove un-needed
* scrollbars, as well as add one if necessary.
*
* @method _hostDimensionsChange
* @protected
*/
_hostDimensionsChange: function() {
if (this._basic) {
}
}
// Horizontal
if (this._basic) {
}
}
this._update();
},
/**
* Position and resize the scroll bars according to the content size
*
* @method _update
* @param currentPos {Number} The current scrollX or scrollY value (not used here, but passed by default from _uiScrollX/_uiScrollY)
* @param duration {Number} Number of ms of animation (optional) - used when snapping to bounds
* @param easing {String} Optional easing equation to use during the animation, if duration is set
* @protected
*/
scrollSize = 0,
scrollPos = 1,
size,
node;
// TODO: Remove 4px cross dependency on CSS
if(!this._showingScrollBars) {
this.show();
}
this.hide();
return;
}
if(verticalNode) {
if(scrollSize > height) {
scrollSize = 1;
}
if (NATIVE_TRANSITIONS) {
} else {
transformX = 0;
}
}
if(scrollPos < 0) {
if (NATIVE_TRANSITIONS) {
transform = 'translate(0,0)';
} else {
transformX = 0;
transformY = 0;
}
}
if(this.verticalScrollSize != (size)) {
this.verticalScrollSize = (size);
transition = {
};
if(NATIVE_TRANSITIONS) {
} else {
if (!basic) {
}
}
}
transition = {
};
if (NATIVE_TRANSITIONS) {
} else {
}
transition = {
};
if (NATIVE_TRANSITIONS) {
} else {
if (!basic) {
}
}
}
if(horizontalNode) {
if(scrollSize > width) {
scrollSize = 1;
}
if (NATIVE_TRANSITIONS) {
} else {
transformY = 0;
}
{
}
if(scrollPos < 0)
{
if (NATIVE_TRANSITIONS) {
transform = 'translate(0,0)';
} else {
transformX = 0;
transformY = 0;
}
}
if(this.horizontalScrollSize != (size)) {
this.horizontalScrollSize = size;
transition = {
};
if(NATIVE_TRANSITIONS) {
} else {
//transition.bottom = 0;
if (!basic) {
}
}
}
transition = {
};
if (NATIVE_TRANSITIONS) {
} else {
//transition.bottom = transformY;
}
transition = {
};
if (NATIVE_TRANSITIONS) {
} else {
//transition.bottom = 0;
}
}
},
/**
* Show the scroll bar indicators
*
* @method show
* @param animated {Boolean} Whether or not to animate the showing
*/
},
/**
* Hide the scroll bar indicators
*
* @method hide
* @param animated {Boolean} Whether or not to animate the hiding
*/
},
/**
*
* @method _show
* @param {Object} show
* @param {Object} animated
* @protected
*/
transition = {
};
this._showingScrollBars = show;
if(this._flashTimer) {
this._flashTimer.cancel();
}
if(verticalNode) {
}
if(horizontalNode) {
}
},
/**
* Momentarily flash the scroll bars to indicate current scroll position
*
* @method flash
*/
flash: function() {
var shouldFlash = false,
shouldFlash = true;
}
shouldFlash = true;
}
if(shouldFlash) {
this.show(true);
}
},
/**
* Setter for the verticalNode attribute
*
* @method _setVerticalNode
* @param node {Y.Node} The Y.Node instance for the scrollbar
* @protected
*/
_setVerticalNode: function(node) {
if(node) {
}
return node;
},
/**
* Setter for the horizontalNode attribute
*
* @method _setHorizontalNode
* @param node {Y.Node} The Y.Node instance for the scrollbar
* @protected
*/
_setHorizontalNode: function(node) {
if(node) {
}
return node;
},
});