From eac9b71b958239af323cb0d7f2a37928adb9ac81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 7 Apr 2014 16:57:02 +0200 Subject: [PATCH 1/2] Set shouldStopEvent to identity in DragBox This fixes a bug where the map is panned when boxes are drawn. --- src/ol/interaction/dragboxinteraction.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ol/interaction/dragboxinteraction.js b/src/ol/interaction/dragboxinteraction.js index 62ea2488d0..998fb985bd 100644 --- a/src/ol/interaction/dragboxinteraction.js +++ b/src/ol/interaction/dragboxinteraction.js @@ -6,6 +6,7 @@ goog.provide('ol.interaction.DragBox'); goog.require('goog.asserts'); goog.require('goog.events.Event'); +goog.require('goog.functions'); goog.require('ol.events.ConditionType'); goog.require('ol.events.condition'); goog.require('ol.interaction.Pointer'); @@ -192,3 +193,9 @@ ol.interaction.DragBox.prototype.handlePointerDown = return false; } }; + + +/** + * @inheritDoc + */ +ol.interaction.DragBox.prototype.shouldStopEvent = goog.functions.identity; From ce0b1d2a470fa100d49eda481b85f03e9a0b784d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 7 Apr 2014 16:59:04 +0200 Subject: [PATCH 2/2] Use goog.functions.identity where it makes sense --- src/ol/interaction/dragrotateandzoominteraction.js | 10 ++++------ src/ol/interaction/modifyinteraction.js | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/ol/interaction/dragrotateandzoominteraction.js b/src/ol/interaction/dragrotateandzoominteraction.js index 79cdd29d69..80b689dfa4 100644 --- a/src/ol/interaction/dragrotateandzoominteraction.js +++ b/src/ol/interaction/dragrotateandzoominteraction.js @@ -3,6 +3,7 @@ goog.provide('ol.interaction.DragRotateAndZoom'); goog.require('goog.asserts'); +goog.require('goog.functions'); goog.require('goog.math.Vec2'); goog.require('ol.ViewHint'); goog.require('ol.events.ConditionType'); @@ -153,11 +154,8 @@ ol.interaction.DragRotateAndZoom.prototype.handlePointerDown = /** * @inheritDoc + * Stop the event if it was handled, so that interaction `DragZoom` + * does not interfere. */ ol.interaction.DragRotateAndZoom.prototype.shouldStopEvent = - function(hasHandledEvent) { - /* Stop the event if it was handled, so that interaction `DragZoom` - * does not interfere. - */ - return hasHandledEvent; -}; + goog.functions.identity; diff --git a/src/ol/interaction/modifyinteraction.js b/src/ol/interaction/modifyinteraction.js index 75979b419e..e057693b7c 100644 --- a/src/ol/interaction/modifyinteraction.js +++ b/src/ol/interaction/modifyinteraction.js @@ -735,9 +735,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() { /** * @inheritDoc */ -ol.interaction.Modify.prototype.shouldStopEvent = function(handled) { - return handled; -}; +ol.interaction.Modify.prototype.shouldStopEvent = goog.functions.identity; /**