diff options
author | bob <bcz@cs.brown.edu> | 2020-03-09 12:12:47 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2020-03-09 12:12:47 -0400 |
commit | d46ff869dcbb3d5cadeeb9ad6251ef5f9a5c3b2d (patch) | |
tree | 92ed9e094f1a6039656542476806922524e4f186 /src/client/views/nodes/DocumentBox.tsx | |
parent | adc6a86ca44d74d3efd4439a344929ca09815362 (diff) |
fixed interactions with documentBox
Diffstat (limited to 'src/client/views/nodes/DocumentBox.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentBox.tsx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentBox.tsx b/src/client/views/nodes/DocumentBox.tsx index bd239491b..978480142 100644 --- a/src/client/views/nodes/DocumentBox.tsx +++ b/src/client/views/nodes/DocumentBox.tsx @@ -76,13 +76,18 @@ export class DocumentBox extends DocAnnotatableComponent<FieldViewProps, DocBoxS } } onPointerDown = (e: React.PointerEvent) => { - if (e.button === 0 && !e.ctrlKey) { + if (this.active() && e.button === 0 && !e.ctrlKey) { e.stopPropagation(); } } + onLockClick = (e: React.MouseEvent) => { + this.toggleLockSelection(); + (e.nativeEvent as any).formattedHandled = true; + e.stopPropagation(); + } onClick = (e: React.MouseEvent) => { let hitWidget: boolean | undefined = false; - if (this._contRef.current!.getBoundingClientRect().top + 15 > e.clientY) hitWidget = this.toggleLockSelection(); + if (this._contRef.current!.getBoundingClientRect().top + 15 > e.clientY) hitWidget = (() => { this.props.select(false); return true; })(); else if (this._contRef.current!.getBoundingClientRect().bottom - 15 < e.clientY) hitWidget = (() => { this.props.select(false); return true; })(); else { if (this._contRef.current!.getBoundingClientRect().left + 15 > e.clientX) hitWidget = this.prevSelection(); @@ -104,7 +109,7 @@ export class DocumentBox extends DocAnnotatableComponent<FieldViewProps, DocBoxS onContextMenu={this.specificContextMenu} onPointerDown={this.onPointerDown} onClick={this.onClick} style={{ background: StrCast(this.props.Document.backgroundColor) }}> - <div className="documentBox-lock"> + <div className="documentBox-lock" onClick={this.onLockClick}> <FontAwesomeIcon icon={this.isSelectionLocked() ? "lock" : "unlock"} size="sm" /> </div> {!(containedDoc instanceof Doc) ? (null) : <ContentFittingDocumentView |