Add ol.MapBrowserEvent.stopOtherInteractions
When called, stops the interaction chain.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,6 +93,7 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
goog.bind(this.doZoom_, this, map), timeLeft);
|
||||
|
||||
mapBrowserEvent.preventDefault();
|
||||
mapBrowserEvent.stopOtherInteractions();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user