dd-scroll-debug.js revision 76ca635d61eb3f9fb7c9d788a44fa8b1690aa138
c40265eba0c99708887d68e67901924065ba2514Brian Wellington * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll.
c40265eba0c99708887d68e67901924065ba2514Brian Wellington * This class should not be called on it's own, it's designed to be a plugin.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @submodule dd-scroll
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * Base scroller class used to create the Plugin.DDNodeScroll and Plugin.DDWinScroll.
af5073d03288a53b646ec3b807ac25ced64d7879Mark Andrews * This class should not be called on it's own, it's designed to be a plugin.
af5073d03288a53b646ec3b807ac25ced64d7879Mark Andrews * @class Scroll
af5073d03288a53b646ec3b807ac25ced64d7879Mark Andrews * @extends Base
af5073d03288a53b646ec3b807ac25ced64d7879Mark Andrews * @namespace DD
c40265eba0c99708887d68e67901924065ba2514Brian Wellington * @constructor
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein var S = function() {
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein S.superclass.constructor.apply(this, arguments);
71c66a876ecca77923638d3f94cc0783152b2f03Mark Andrews * @attribute parentScroll
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description Internal config option to hold the node that we are scrolling. Should not be set by the developer.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @type Node
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews return false;
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @attribute buffer
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @description The number of pixels from the edge of the screen to turn on scrolling. Default: 30
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @type Number
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @attribute scrollDelay
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description The number of milliseconds delay to pass to the auto scroller. Default: 235
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @type Number
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @attribute host
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description The host we are plugged into.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @type Object
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @attribute windowScroll
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description Turn on window scroll support, default: false
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @type Boolean
a057e8e33baa5fa369be28a9680585200ce3ff73Mark Andrews * @attribute vertical
a057e8e33baa5fa369be28a9680585200ce3ff73Mark Andrews * @description Allow vertical scrolling, default: true.
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @type Boolean
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @attribute horizontal
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @description Allow horizontal scrolling, default: true.
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @type Boolean
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @property _scrolling
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @description Tells if we are actively scrolling or not.
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @type Boolean
a057e8e33baa5fa369be28a9680585200ce3ff73Mark Andrews * @property _vpRegionCache
a057e8e33baa5fa369be28a9680585200ce3ff73Mark Andrews * @description Cache of the Viewport dims.
3a3705ef7747327df182bf8d009333d2472253d5Mark Andrews * @type Object
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @property _dimCache
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @description Cache of the dragNode dims.
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @type Object
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @property _scrollTimer
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @description Holder for the Timer object returned from Y.later.
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @type {Y.later}
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @method _getVPRegion
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description Sets the _vpRegionCache property with an Object containing the dims from the viewport.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein h.after('drag:start', Y.bind(this.start, this));
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews //TODO - This doesn't work yet??
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @method _checkWinScroll
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews * @description Check to see if we need to fire the scroll timer. If scroll timer is running this will scroll the window.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @param {Boolean} move Should we move the window. From Y.later
7208386cd37a2092c70eddf80cf29519b16c4c80Mark Andrews var r = this._getVPRegion(),
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @method _initScroll
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein * @description Cancel a previous scroll timer and init a new one.
_initScroll: function() {
this._cancelScroll();
this._scrollTimer = Y.Lang.later(this.get('scrollDelay'), this, this._checkWinScroll, [true], true);
_cancelScroll: function() {
this._scrolling = false;
if (this._scrollTimer) {
delete this._scrollTimer;
align: function(e) {
if (this._scrolling) {
this._cancelScroll();
e.preventDefault();
if (!this._scrolling) {
this._checkWinScroll();
_setDimCache: function() {
this._dimCache = {
start: function() {
this._setDimCache();
this._dimCache = null;
this._cancelScroll();
toString: function() {
WS = function() {
windowScroll: {
value: true,
if (scroll) {
return scroll;
initializer: function() {
* @description The Scroll instance will be placed on the Drag instance under the winscroll namespace.
NS = function() {
node: {
value: false,
if (node !== false) {
initializer: function() {