aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/WebBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-17 02:14:31 -0400
committerbobzel <zzzman@gmail.com>2021-09-17 02:14:31 -0400
commitf5c4aa829955467c37ff35fb47b6d3c47fef4590 (patch)
treee7e1726781fd1002c57900e9bb86864881ead277 /src/client/views/nodes/WebBox.tsx
parent1de71a39f1f6ebc2c909c92694db340cc9b256a0 (diff)
fixed right-drag marquee on webBox on Mac
Diffstat (limited to 'src/client/views/nodes/WebBox.tsx')
-rw-r--r--src/client/views/nodes/WebBox.tsx26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/client/views/nodes/WebBox.tsx b/src/client/views/nodes/WebBox.tsx
index acccccfb4..9dafaadcb 100644
--- a/src/client/views/nodes/WebBox.tsx
+++ b/src/client/views/nodes/WebBox.tsx
@@ -247,20 +247,10 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
}
// bcz: hack - iframe grabs all events which messes up how we handle contextMenus. So this super naively simulates the event stack to get the specific menu items and the doc view menu items.
- if (e.button === 2) {
+ if (e.button === 2 || (e.button === 0 && e.ctrlKey)) {
e.preventDefault();
e.stopPropagation();
- const where = this.props.ScreenToLocalTransform().inverse().transformPoint(e.pageX, e.pageY);
- if (ContextMenu.Instance.getItems().length) {
- ContextMenu.Instance.displayMenu(where[0], where[1]);
- }
- else {
- ContextMenu.Instance.closeMenu();
- this.specificContextMenu(e);
- this.props.docViewPath().lastElement().docView?.onContextMenu(undefined, where[0], where[1]);
- }
- } else {
- ContextMenu.Instance.closeMenu();
+ ContextMenu.Instance.setIgnoreEvents(true);
}
}
@@ -457,11 +447,19 @@ export class WebBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps
}), returnFalse, () => MarqueeAnnotator.clearAnnotations(this._savedAnnotations), false);
}
}
- @action finishMarquee = (x?: number, y?: number) => {
+ @action finishMarquee = (x?: number, y?: number, e?: PointerEvent) => {
this._marqueeing = undefined;
this._isAnnotating = false;
this._iframeClick = undefined;
- x !== undefined && y !== undefined && this._setPreviewCursor?.(x, y, false, false);
+ if (x !== undefined && y !== undefined) {
+ this._setPreviewCursor?.(x, y, false, false);
+ ContextMenu.Instance.closeMenu();
+ ContextMenu.Instance.setIgnoreEvents(false);
+ if (e?.button === 2 || e?.ctrlKey) {
+ this.specificContextMenu(undefined as any);
+ this.props.docViewPath().lastElement().docView?.onContextMenu(undefined, x, y);
+ }
+ }
}
@computed get urlContent() {