diff --git a/src/ol/interaction/doubleclickzoominteraction.js b/src/ol/interaction/doubleclickzoominteraction.js index ffae0a057a..29fb5050b4 100644 --- a/src/ol/interaction/doubleclickzoominteraction.js +++ b/src/ol/interaction/doubleclickzoominteraction.js @@ -52,5 +52,6 @@ ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent = ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor, ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION); mapBrowserEvent.preventDefault(); + mapBrowserEvent.stopOtherInteractions(); } }; diff --git a/src/ol/interaction/keyboardpaninteraction.js b/src/ol/interaction/keyboardpaninteraction.js index ce57d6ddcc..ecd780c430 100644 --- a/src/ol/interaction/keyboardpaninteraction.js +++ b/src/ol/interaction/keyboardpaninteraction.js @@ -82,6 +82,7 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent = ol.interaction.Interaction.pan( map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION); mapBrowserEvent.preventDefault(); + mapBrowserEvent.stopOtherInteractions(); } } }; diff --git a/src/ol/interaction/keyboardzoominteraction.js b/src/ol/interaction/keyboardzoominteraction.js index 3096b95a94..bf23e2adfa 100644 --- a/src/ol/interaction/keyboardzoominteraction.js +++ b/src/ol/interaction/keyboardzoominteraction.js @@ -63,6 +63,7 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent = ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined, ol.interaction.KEYBOARD_ZOOM_DURATION); mapBrowserEvent.preventDefault(); + mapBrowserEvent.stopOtherInteractions(); } } }; diff --git a/src/ol/interaction/mousewheelzoominteraction.js b/src/ol/interaction/mousewheelzoominteraction.js index a23ade23a4..2042565c5e 100644 --- a/src/ol/interaction/mousewheelzoominteraction.js +++ b/src/ol/interaction/mousewheelzoominteraction.js @@ -93,6 +93,7 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent = goog.bind(this.doZoom_, this, map), timeLeft); mapBrowserEvent.preventDefault(); + mapBrowserEvent.stopOtherInteractions(); } }; diff --git a/src/ol/map.js b/src/ol/map.js index 5f0fa37b6e..c1864078e5 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -644,7 +644,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) { for (i = interactionsArray.length - 1; i >= 0; i--) { var interaction = interactionsArray[i]; interaction.handleMapBrowserEvent(mapBrowserEvent); - if (mapBrowserEvent.defaultPrevented) { + if (mapBrowserEvent.otherInteractionsStopped) { break; } } diff --git a/src/ol/mapbrowserevent.js b/src/ol/mapbrowserevent.js index bea207c085..fef87dd41f 100644 --- a/src/ol/mapbrowserevent.js +++ b/src/ol/mapbrowserevent.js @@ -39,6 +39,11 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) { */ this.coordinate_ = null; + /** + * @type {boolean} + */ + this.otherInteractionsStopped = false; + /** * @private * @type {ol.Pixel} @@ -107,6 +112,14 @@ ol.MapBrowserEvent.prototype.preventDefault = function() { }; +/** + * Stop the interaction chain. + */ +ol.MapBrowserEvent.prototype.stopOtherInteractions = function() { + this.otherInteractionsStopped = true; +}; + + /** * @override */