scrollview-paginator.js revision d5daadf7c87a641483741ee68c26b343acb5717c
/**
* Provides a plugin, which adds pagination support to ScrollView instances
*
* @module scrollview-paginator
*/
INDEX = "index",
SCROLL_X = "scrollX",
SCROLL_Y = "scrollY",
TOTAL = "total",
BOUNDING_BOX = "boundingBox",
CONTENT_BOX = "contentBox";
/**
* Scrollview plugin that adds support for paging
*
* @class ScrollViewPaginator
* @namespace Plugin
* @extends Plugin.Base
* @constructor
*/
function PaginatorPlugin() {
}
/**
* The identity of the plugin
*
* @property ScrollViewPaginator.NAME
* @type String
* @default 'paginatorPlugin'
* @static
*/
/**
* The namespace on which the plugin will reside
*
* @property ScrollViewPaginator.NS
* @type String
* @default 'pages'
* @static
*/
/**
* The default attribute configuration for the plugin
*
* @property ScrollViewPaginator.ATTRS
* @type Object
* @static
*/
PaginatorPlugin.ATTRS = {
/**
* CSS selector for a page inside the scrollview. The scrollview
* will snap to the closest page.
*
* @attribute selector
* @type {String}
*/
selector: {
value: null
},
/**
* The active page number for a paged scrollview
*
* @attribute index
* @type {Number}
* @default 0
*/
index: {
value: 0
},
/**
* The total number of pages
*
* @attribute total
* @type {Number}
* @default 0
*/
total: {
value: 0
}
};
/**
* Designated initializer
*
* @method initializer
*/
initializer: function() {
var host,
paginator = this; // kweight
},
/**
* Calculate the page boundary offsets
*
* @method _calcOffsets
* @protected
*/
_calcOffsets : function() {
},
/**
* Executed to respond to the flick event, by over-riding the default flickFrame animation.
* This is needed to determine if the next or prev page should be activated.
*
* @method _flickFrame
* @protected
*/
_flickFrame: function() {
if (velocity) {
}
}
return this._prevent;
},
/**
* After host render handler
*
* @method _afterRender
* @protected
*/
_afterRender: function(e) {
},
/**
* scrollEnd handler detects if a page needs to change
*
* @method _scrollEnded
* @param {Event.Facade}
* @protected
*/
_scrollEnded: function(e) {
if(host._scrolledHalfway) {
} else if (pageIndex > 0) {
} else {
}
} else {
}
}
},
/**
* index attr change handler
*
* @method _afterIndexChange
* @protected
*/
_afterIndexChange: function(e) {
}
},
/**
* Update the UI based on the current page index
*
* @method _uiIndex
* @protected
*/
},
/**
* Scroll to the next page in the scrollview, with animation
*
* @method next
*/
next: function() {
}
},
/**
* Scroll to the previous page in the scrollview, with animation
*
* @method prev
*/
prev: function() {
if(index > 0) {
}
},
/**
* Scroll to a given page in the scrollview, with animation.
*
* @method scrollTo
* @param index {Number} The index of the page to scroll to
* @param duration {Number} The number of ms the animation should last
* @param easing {String} The timing function to use in the animation
*/
});
},
/**
* Snaps the scrollview to the currently selected page
*
* @method snapToCurrent
* @param duration {Number} The number of ms the animation should last
* @param easing {String} The timing function to use in the animation
*/
host._killTimer();
});
},
});
/**
* The default snap to current duration and easing values used on scroll end.
*
* @property SNAP_TO_CURRENT
* @static
*/
duration : 300,
easing : 'ease-out'
};