aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx')
-rw-r--r--src/client/views/nodes/CollectionFreeFormDocumentView.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
index 8851e4b93..fa44ec9f3 100644
--- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
+++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx
@@ -32,6 +32,8 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
private _mainCont = React.createRef<HTMLDivElement>();
private _downX: number = 0;
private _downY: number = 0;
+ private _doubleTap = false;
+ private _lastTap: number = 0;
_bringToFrontDisposer?: IReactionDisposer;
@computed get transform() {
@@ -159,18 +161,16 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
}, 500);
}
}
- private _lastTap: number = 0;
static _undoBatch?: UndoManager.Batch = undefined;
onPointerDown = (e: React.PointerEvent): void => {
this._downX = e.clientX;
this._downY = e.clientY;
+ this._doubleTap = false;
if (e.button === 0 && e.altKey) {
e.stopPropagation(); // prevents panning from happening on collection if shift is pressed after a document drag has started
} // allow pointer down to go through otherwise so that marquees can be drawn starting over a document
if (Date.now() - this._lastTap < 300) {
if (e.buttons === 1) {
- this._downX = e.clientX;
- this._downY = e.clientY;
document.removeEventListener("pointerup", this.onPointerUp);
document.addEventListener("pointerup", this.onPointerUp);
}
@@ -180,14 +180,16 @@ export class CollectionFreeFormDocumentView extends DocComponent<CollectionFreeF
}
onPointerUp = (e: PointerEvent): void => {
document.removeEventListener("pointerup", this.onPointerUp);
- if (!(e as any).propagationIsStopped && Math.abs(e.clientX - this._downX) < 2 && Math.abs(e.clientY - this._downY) < 2) {
- this.props.addDocTab(this.props.Document, "inTab");
- (e as any).propagationIsStopped = true;
+ if (Math.abs(e.clientX - this._downX) < 2 && Math.abs(e.clientY - this._downY) < 2) {
+ this._doubleTap = true;
}
- e.stopPropagation();
}
onClick = async (e: React.MouseEvent) => {
e.stopPropagation();
+ if (this._doubleTap) {
+ this.props.addDocTab(this.props.Document, "inTab");
+ SelectionManager.DeselectAll();
+ }
let altKey = e.altKey;
if (Math.abs(e.clientX - this._downX) < Utils.DRAG_THRESHOLD &&
Math.abs(e.clientY - this._downY) < Utils.DRAG_THRESHOLD) {