stopPropagation/preventDefault on originalEvent
Move stopPropagation/preventDefault to directly target the originalEvent rather than the mapBrowserEvent.
This commit is contained in:
@@ -52,7 +52,7 @@ class DoubleClickZoom extends Interaction {
|
|||||||
const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||||
const view = map.getView();
|
const view = map.getView();
|
||||||
zoomByDelta(view, delta, anchor, this.duration_);
|
zoomByDelta(view, delta, anchor, this.duration_);
|
||||||
mapBrowserEvent.preventDefault();
|
browserEvent.preventDefault();
|
||||||
stopEvent = true;
|
stopEvent = true;
|
||||||
}
|
}
|
||||||
return !stopEvent;
|
return !stopEvent;
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ class Draw extends PointerInteraction {
|
|||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
if (event.originalEvent.type === EventType.CONTEXTMENU) {
|
if (event.originalEvent.type === EventType.CONTEXTMENU) {
|
||||||
// Avoid context menu for long taps when drawing on mobile
|
// Avoid context menu for long taps when drawing on mobile
|
||||||
event.preventDefault();
|
event.originalEvent.preventDefault();
|
||||||
}
|
}
|
||||||
this.freehand_ =
|
this.freehand_ =
|
||||||
this.mode_ !== Mode.POINT && this.freehandCondition_(event);
|
this.mode_ !== Mode.POINT && this.freehandCondition_(event);
|
||||||
@@ -554,7 +554,7 @@ class Draw extends PointerInteraction {
|
|||||||
this.handlePointerMove_(event);
|
this.handlePointerMove_(event);
|
||||||
if (this.shouldHandle_) {
|
if (this.shouldHandle_) {
|
||||||
// Avoid page scrolling when freehand drawing on mobile
|
// Avoid page scrolling when freehand drawing on mobile
|
||||||
event.preventDefault();
|
event.originalEvent.preventDefault();
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
event.originalEvent.pointerType === 'mouse' ||
|
event.originalEvent.pointerType === 'mouse' ||
|
||||||
@@ -646,7 +646,7 @@ class Draw extends PointerInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pass && this.stopClick_) {
|
if (!pass && this.stopClick_) {
|
||||||
event.stopPropagation();
|
event.originalEvent.stopPropagation();
|
||||||
}
|
}
|
||||||
this.downPx_ = null;
|
this.downPx_ = null;
|
||||||
return pass;
|
return pass;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class KeyboardPan extends Interaction {
|
|||||||
const delta = [deltaX, deltaY];
|
const delta = [deltaX, deltaY];
|
||||||
rotateCoordinate(delta, view.getRotation());
|
rotateCoordinate(delta, view.getRotation());
|
||||||
pan(view, delta, this.duration_);
|
pan(view, delta, this.duration_);
|
||||||
mapBrowserEvent.originalEvent.preventDefault();
|
keyEvent.preventDefault();
|
||||||
stopEvent = true;
|
stopEvent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class KeyboardZoom extends Interaction {
|
|||||||
charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_;
|
charCode == '+'.charCodeAt(0) ? this.delta_ : -this.delta_;
|
||||||
const view = map.getView();
|
const view = map.getView();
|
||||||
zoomByDelta(view, delta, undefined, this.duration_);
|
zoomByDelta(view, delta, undefined, this.duration_);
|
||||||
mapBrowserEvent.originalEvent.preventDefault();
|
keyEvent.preventDefault();
|
||||||
stopEvent = true;
|
stopEvent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,10 +178,9 @@ class MouseWheelZoom extends Interaction {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapBrowserEvent.preventDefault();
|
|
||||||
|
|
||||||
const map = mapBrowserEvent.map;
|
const map = mapBrowserEvent.map;
|
||||||
const wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);
|
const wheelEvent = /** @type {WheelEvent} */ (mapBrowserEvent.originalEvent);
|
||||||
|
wheelEvent.preventDefault();
|
||||||
|
|
||||||
if (this.useAnchor_) {
|
if (this.useAnchor_) {
|
||||||
this.lastAnchor_ = mapBrowserEvent.coordinate;
|
this.lastAnchor_ = mapBrowserEvent.coordinate;
|
||||||
|
|||||||
Reference in New Issue
Block a user