scrollbars-plugin.js revision 3308c1625db1596d4302f9ac69285cbd2e289ae8
/**
* 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();
},
/**
*
* @method _updateDim
* @private
*
* @param {boolean} vert true if vertical, false if horizontal.
* @param {Node} scrollbar The scrollbar node.
* @param {Number} current The current scroll position.
* @param {Number} duration The transition duration.
*/
scrollbarSize = 0,
scrollbarPos = 1,
size,
contentSize = (vert) ? host._scrollHeight || cb.get('scrollHeight') : host._scrollWidth || cb.get('scrollWidth');
scrollbarPos = Math.floor((current/(contentSize - widgetSize)) * (widgetSize - scrollbarSize)) * -1;
if (scrollbarSize > widgetSize) {
scrollbarSize = 1;
}
if (NATIVE_TRANSITIONS) {
transitionTransform = (vert) ? 'translateY(' + scrollbarPos + 'px)' : 'translateX('+scrollbarPos+'px)';
} else {
}
}
if (scrollbarPos < 0) {
if (NATIVE_TRANSITIONS) {
transitionTransform = 'translate(0,0)';
} else {
transitionProp = 0;
}
}
transition = {
};
if(NATIVE_TRANSITIONS) {
} else {
}
}
transition = {
};
if (NATIVE_TRANSITIONS) {
} else {
}
transition = {
};
if (NATIVE_TRANSITIONS) {
transition.transform = (vert) ? 'translateY('+(scrollbarSize-10)+'px)' : 'translateX('+(scrollbarSize-12)+'px)';
} else {
if (vert) {
} else {
}
}
}
},
/**
* 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
*/
if (!this._showingScrollBars) {
this.show();
}
if (vNode) {
}
if (hNode) {
}
},
/**
* 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;
},
});