diff options
author | monikahedman <monikahedman@monikas-mbp.devices.brown.edu> | 2019-07-17 13:45:01 -0400 |
---|---|---|
committer | monikahedman <monikahedman@monikas-mbp.devices.brown.edu> | 2019-07-17 13:45:01 -0400 |
commit | 9d16c6d15809c7691e7f32be238a3b22cd0edcb5 (patch) | |
tree | 847fa7bf89b35f3a1b20da30aa043601004ab2ee /src/client/views/ContextMenu.tsx | |
parent | 6bf6cad2fd500f9bb5b527f6950373566f1d6810 (diff) |
does this work
Diffstat (limited to 'src/client/views/ContextMenu.tsx')
-rw-r--r-- | src/client/views/ContextMenu.tsx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx index c97cbd076..1347d4197 100644 --- a/src/client/views/ContextMenu.tsx +++ b/src/client/views/ContextMenu.tsx @@ -30,6 +30,7 @@ export class ContextMenu extends React.Component { @observable private _mouseX: number = -1; @observable private _mouseY: number = -1; @observable private _shouldDisplay: boolean = false; + @observable private _mouseDown: boolean = false; private _reactionDisposer?: IReactionDisposer; @@ -43,11 +44,15 @@ export class ContextMenu extends React.Component { componentDidMount = () => { document.addEventListener("pointerdown", e => { runInAction(() => { + this._mouseDown = true; this._mouseX = e.clientX; this._mouseY = e.clientY; }); }); document.addEventListener("pointerup", e => { + runInAction(() => { + this._mouseDown = false; + }) let curX = e.clientX; let curY = e.clientY; if (this._mouseX !== curX || this._mouseY !== curY) { @@ -56,17 +61,17 @@ export class ContextMenu extends React.Component { }); } - // if (this._shouldDisplay) { - // runInAction(() => { - // this._display = true; - // }); - // } + if (this._shouldDisplay) { + runInAction(() => { + this._display = true; + }); + } }); this._reactionDisposer = reaction( () => this._shouldDisplay, () => { - if (this._shouldDisplay) { + if (this._shouldDisplay && !this._mouseDown) { runInAction(() => { this._display = true; }); |