Merge pull request #16825 from calixteman/editor_avoid_right_click
[Editor] Avoid showing the context menu or resizing when a resizer is right clicked
This commit is contained in:
commit
1d523d3ec1
@ -460,6 +460,10 @@ class AnnotationEditor {
|
|||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static #noContextMenu(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
#createResizers() {
|
#createResizers() {
|
||||||
if (this.#resizersDiv) {
|
if (this.#resizersDiv) {
|
||||||
return;
|
return;
|
||||||
@ -478,12 +482,18 @@ class AnnotationEditor {
|
|||||||
"pointerdown",
|
"pointerdown",
|
||||||
this.#resizerPointerdown.bind(this, name)
|
this.#resizerPointerdown.bind(this, name)
|
||||||
);
|
);
|
||||||
|
div.addEventListener("contextmenu", AnnotationEditor.#noContextMenu);
|
||||||
}
|
}
|
||||||
this.div.prepend(this.#resizersDiv);
|
this.div.prepend(this.#resizersDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#resizerPointerdown(name, event) {
|
#resizerPointerdown(name, event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
const { isMac } = FeatureTest.platform;
|
||||||
|
if (event.button !== 0 || (event.ctrlKey && isMac)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
|
const boundResizerPointermove = this.#resizerPointermove.bind(this, name);
|
||||||
const savedDraggable = this._isDraggable;
|
const savedDraggable = this._isDraggable;
|
||||||
this._isDraggable = false;
|
this._isDraggable = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user