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 | |
parent | adc6a86ca44d74d3efd4439a344929ca09815362 (diff) |
fixed interactions with documentBox
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DocumentBox.tsx | 11 | ||||
-rw-r--r-- | src/new_fields/Doc.ts | 1 |
2 files changed, 8 insertions, 4 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 diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 81e32484c..4a6ff8e42 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -481,7 +481,6 @@ export namespace Doc { setTimeout(action(() => { if (!targetDoc[expandedLayoutFieldKey]) { const newLayoutDoc = Doc.MakeDelegate(templateLayoutDoc, undefined, "[" + templateLayoutDoc.title + "]"); - newLayoutDoc.lockedPosition = true; newLayoutDoc.expandedTemplate = targetDoc; targetDoc[expandedLayoutFieldKey] = newLayoutDoc; const dataDoc = Doc.GetProto(targetDoc); |