From fa970f1ae2f3f81b14ef93f6e8377471710cd29d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 24 May 2013 18:17:41 -0500 Subject: [PATCH] Allow user to stop map at the end of a drag If the time between the last move and now is longer than the configured delay, this means that the user stopped panning before releasing the map. --- src/ol/kinetic.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ol/kinetic.js b/src/ol/kinetic.js index e77964a00e..0d45bed82e 100644 --- a/src/ol/kinetic.js +++ b/src/ol/kinetic.js @@ -79,6 +79,10 @@ ol.Kinetic.prototype.update = function(x, y) { ol.Kinetic.prototype.end = function() { var delay = goog.now() - this.delay_; var lastIndex = this.points_.length - 3; + if (this.points_[lastIndex + 2] < delay) { + // the user stopped panning before releasing the map + return false; + } var firstIndex = lastIndex - 3; while (firstIndex >= 0 && this.points_[firstIndex + 2] > delay) { firstIndex -= 3;