From 5906168bc000a7c12d61c662ee5e97bd4bc42ecb Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 2 Apr 2013 11:51:59 +0200 Subject: [PATCH] Don't recompute delay every loop --- src/ol/kinetic.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ol/kinetic.js b/src/ol/kinetic.js index e6b78526d2..9632abf804 100644 --- a/src/ol/kinetic.js +++ b/src/ol/kinetic.js @@ -89,10 +89,10 @@ ol.Kinetic.prototype.update = function(x, y) { * @return {boolean} Whether we should do kinetic animation. */ ol.Kinetic.prototype.end = function() { - var now = goog.now(); + var delay = goog.now() - this.delay_; var lastIndex = this.points_.length - 1; var firstIndex = lastIndex - 1; - while (firstIndex >= 0 && this.points_[firstIndex].t > now - this.delay_) { + while (firstIndex >= 0 && this.points_[firstIndex].t > delay) { firstIndex--; } if (firstIndex >= 0) {