From d59b6bc40fe9d538d8c664d003be5715d2ee0253 Mon Sep 17 00:00:00 2001 From: herrernst Date: Fri, 2 Jan 2015 13:24:30 +0100 Subject: [PATCH] when rAF is paused (e.g. browser tab is put to background) and then later on continued, diff factor could increase above 1 and thus animation would be quite weird (approached target value from other direction) --- src/dragdealer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dragdealer.js b/src/dragdealer.js index 0d40727..1a443c7 100644 --- a/src/dragdealer.js +++ b/src/dragdealer.js @@ -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); }