From 1b18dbedb7b6d8d2586696e60f8104335ab908dd Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 27 Sep 2012 09:54:16 +0200 Subject: [PATCH] Dispatch MapBrowserEvent before interactions get it By doing so, application event handlers can preventDefault on the event, and interactions won't get the event any more. This means that interactions are default behavior that can be prevented by application event handlers. --- src/ol/map.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ol/map.js b/src/ol/map.js index 0f5641eae3..aa32083e67 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -490,11 +490,12 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) { var interactions = this.getInteractions(); var interactionsArray = /** @type {Array.} */ interactions.getArray(); - goog.array.every(interactionsArray, function(interaction) { - interaction.handleMapBrowserEvent(mapBrowserEvent); - return !mapBrowserEvent.defaultPrevented; - }); - this.dispatchEvent(mapBrowserEvent); + if (this.dispatchEvent(mapBrowserEvent) !== false) { + goog.array.every(interactionsArray, function(interaction) { + interaction.handleMapBrowserEvent(mapBrowserEvent); + return !mapBrowserEvent.defaultPrevented; + }); + } };