From 5cdd96b131baf654e55b8e9059d9e1a415dd85f5 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 27 Aug 2014 10:23:13 +0200 Subject: [PATCH] Don't compute velocity if not needed --- 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 a6d9b54d67..c4cf3b99c2 100644 --- a/src/ol/kinetic.js +++ b/src/ol/kinetic.js @@ -115,7 +115,7 @@ ol.Kinetic.prototype.end = function() { ol.Kinetic.prototype.pan = function(source) { var decay = this.decay_; var initialVelocity = this.initialVelocity_; - var minVelocity = this.minVelocity_; + var velocity = this.minVelocity_ - initialVelocity; var duration = this.getDuration_(); var easingFunction = ( /** @@ -124,7 +124,7 @@ ol.Kinetic.prototype.pan = function(source) { */ function(t) { return initialVelocity * (Math.exp((decay * t) * duration) - 1) / - (minVelocity - initialVelocity); + velocity; }); return ol.animation.pan({ source: source,