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.
This commit is contained in:
@@ -490,11 +490,12 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
var interactions = this.getInteractions();
|
||||
var interactionsArray = /** @type {Array.<ol.interaction.Interaction>} */
|
||||
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;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user