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.Interaction.zoomByDelta(map, view, delta, anchor,
|
||||||
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
|
ol.interaction.DOUBLECLICKZOOM_ANIMATION_DURATION);
|
||||||
mapBrowserEvent.preventDefault();
|
mapBrowserEvent.preventDefault();
|
||||||
|
mapBrowserEvent.stopOtherInteractions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
|||||||
ol.interaction.Interaction.pan(
|
ol.interaction.Interaction.pan(
|
||||||
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||||
mapBrowserEvent.preventDefault();
|
mapBrowserEvent.preventDefault();
|
||||||
|
mapBrowserEvent.stopOtherInteractions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
|||||||
ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined,
|
ol.interaction.Interaction.zoomByDelta(map, view, delta, undefined,
|
||||||
ol.interaction.KEYBOARD_ZOOM_DURATION);
|
ol.interaction.KEYBOARD_ZOOM_DURATION);
|
||||||
mapBrowserEvent.preventDefault();
|
mapBrowserEvent.preventDefault();
|
||||||
|
mapBrowserEvent.stopOtherInteractions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
|||||||
goog.bind(this.doZoom_, this, map), timeLeft);
|
goog.bind(this.doZoom_, this, map), timeLeft);
|
||||||
|
|
||||||
mapBrowserEvent.preventDefault();
|
mapBrowserEvent.preventDefault();
|
||||||
|
mapBrowserEvent.stopOtherInteractions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
|||||||
for (i = interactionsArray.length - 1; i >= 0; i--) {
|
for (i = interactionsArray.length - 1; i >= 0; i--) {
|
||||||
var interaction = interactionsArray[i];
|
var interaction = interactionsArray[i];
|
||||||
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
||||||
if (mapBrowserEvent.defaultPrevented) {
|
if (mapBrowserEvent.otherInteractionsStopped) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) {
|
|||||||
*/
|
*/
|
||||||
this.coordinate_ = null;
|
this.coordinate_ = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.otherInteractionsStopped = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Pixel}
|
* @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
|
* @override
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user