Skip to content

Commit

Permalink
when rAF is paused (e.g. browser tab is put to background) and then l…
Browse files Browse the repository at this point in the history
…ater on continued, diff factor could increase above 1 and thus animation would be quite weird (approached target value from other direction)
  • Loading branch information
herrernst committed Jan 2, 2015
1 parent 90fb506 commit d59b6bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dragdealer.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@ Dragdealer.prototype = {
}
if (Math.abs(diff[0]) > this.valuePrecision[0] ||
Math.abs(diff[1]) > this.valuePrecision[1]) {
this.value.current[0] += diff[0] * this.options.speed * this.timeOffset / 25;
this.value.current[1] += diff[1] * this.options.speed * this.timeOffset / 25;
this.value.current[0] += diff[0] * Math.min(this.options.speed * this.timeOffset / 25, 1);
this.value.current[1] += diff[1] * Math.min(this.options.speed * this.timeOffset / 25, 1);
} else {
this.groupCopy(this.value.current, this.value.target);
}
Expand Down

0 comments on commit d59b6bc

Please sign in to comment.