Merge pull request #833 from elemoine/stop-other-interactions
Remove ol.MapBrowserEvent#stopOtherInteractions
This commit is contained in:
@@ -41,6 +41,7 @@ goog.inherits(ol.interaction.DoubleClickZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK &&
|
||||
mapBrowserEvent.isMouseActionButton()) {
|
||||
@@ -52,6 +53,7 @@ ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, anchor,
|
||||
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -95,8 +95,9 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var map = mapBrowserEvent.map;
|
||||
if (!map.isDef()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
var stopEvent = false;
|
||||
var view = map.getView();
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DOWN) {
|
||||
@@ -132,7 +133,8 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||
this.dragging_ = true;
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,9 @@ ol.interaction.Interaction = function() {
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} Whether the map browser event should continue
|
||||
* through the chain of interactions. false means stop, true
|
||||
* means continue.
|
||||
*/
|
||||
ol.interaction.Interaction.prototype.handleMapBrowserEvent =
|
||||
goog.abstractMethod;
|
||||
|
||||
@@ -52,6 +52,7 @@ goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
@@ -81,7 +82,8 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.pan(
|
||||
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -49,6 +49,7 @@ goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
(mapBrowserEvent.browserEvent);
|
||||
@@ -63,7 +64,8 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined,
|
||||
ol.interaction.KEYBOARD_ZOOM_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ goog.inherits(ol.interaction.MouseWheelZoom, ol.interaction.Interaction);
|
||||
*/
|
||||
ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
|
||||
var stopEvent = false;
|
||||
if (mapBrowserEvent.type ==
|
||||
goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) {
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -93,8 +93,9 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
goog.bind(this.doZoom_, this, map), timeLeft);
|
||||
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -126,4 +126,5 @@ ol.interaction.Touch.prototype.handleMapBrowserEvent =
|
||||
}
|
||||
this.handled_ = handled;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user