Browse Source

Merge pull request #2 from Gillingham/updevelop

Add a new moveTo function to Range
css_transitions
Jos de Jong 11 years ago
parent
commit
ea5fd2130f
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      src/timeline/Range.js

+ 16
- 0
src/timeline/Range.js View File

@ -522,3 +522,19 @@ Range.prototype.move = function(moveFactor) {
this.start = newStart;
this.end = newEnd;
};
/**
* Move the range to a new center point
* @param {Number} moveTo New center point of the range
*/
Range.prototype.moveTo = function(moveTo) {
var center = (this.start + this.end) / 2;
var diff = center - moveTo;
// calculate new start and end
var newStart = this.start - diff;
var newEnd = this.end - diff;
this.setRange(newStart, newEnd);
}

Loading…
Cancel
Save