scrollview-paginator.js revision 4bba9ea06b58c829c8fb0debaddca4021dd8bce9
/**
* Provides a plugin, which adds pagination support to ScrollView instances
*
* @module scrollview-paginator
*/
var BOUNCE_DECELERATION_CONST = 0.5,
/**
* Scrollview plugin that adds support for paging
*
* @class ScrollViewPaginatorPlugin
* @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;
// Change bounce constant to increase friction
}
},
/**
* Destructor removes anything added by the plugin
*
* @method destructor
*/
destructor: function() {
}
},
/**
*
* @method _calculatePageOffsets
* @protected
*/
_calculatePageOffsets: function() {
points = [];
}, this);
this._minPoints = points;
},
/**
* based on the page elements
*
* @method _setBoundaryPoints
* @param e {Event.Facade} The gesturemovestart event
*/
_setBoundaryPoints: function(e) {
if(host._scrollsHorizontal) {
} else {
}
}
},
/**
* 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;
},
/**
* scrollEnd handler detects if a page needs to change
*
* @method _scrollEnded
* @param {Event.Facade}
* @protected
*/
_scrollEnded: function(e) {
if(e.onGestureMoveEnd) {
if(host._scrolledHalfway) {
} else if(pageIndex > 0) {
} else {
this.snapToCurrent();
}
} else {
this.snapToCurrent();
}
}
},
/**
* 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
* @param disableAnim {Boolean} If true, no animation is used
*/
next: function(disableAnim) {
}
},
/**
* Scroll to the previous page in the scrollview, with animation
*
* @method prev
* @param disableAnim {Boolean} If true, no animation is used
*/
prev: function(disableAnim) {
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
*/
if(host._scrollsHorizontal) {
x = this._minPoints[index];
});
}
},
/**
* Snaps the scrollview to the currently selected page
*
* @method snapToCurrent
*/
snapToCurrent: function() {
this._host._killTimer();
duration: 300,
easing: 'ease-out'
});
}
});