Skip to content

Commit

Permalink
removing center(), making centerAt() work
Browse files Browse the repository at this point in the history
  • Loading branch information
David Aurelio committed Sep 15, 2010
1 parent a20e8d9 commit c36385c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/touchscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,24 +388,18 @@ TouchScroll.prototype = {

_styleSheet: TouchScroll._styleSheet,

/**
* Centers the scroller.
*
* @returns {TouchScroll} Returns the TouchScroll instance.
*/
center: function center() {
return this;
},

/**
* Centers the scroller at given coordinates.
*
* @param {Number} left The horizontal offset.
* @param {Number} top The vertical offset.
* @returns {TouchScroll} Returns the TouchScroll instance.
* @param {Number} [duration] Duration in milliseconds for the transition.
*/
centerAt: function centerAt(left, top) {
return this;
centerAt: function centerAt(left, top, duration) {
var m = this._metrics;
left += Math.ceil(m.offsetWidth / 2);
top += Math.ceil(m.offsetHeight / 2);
this.scrollTo(left, top, duration);
},

/**
Expand Down

0 comments on commit c36385c

Please sign in to comment.