aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-02-07 19:03:47 -0500
committerbobzel <zzzman@gmail.com>2024-02-07 19:03:47 -0500
commitfda76a08ddf4d47ae8df05b44e6561b4d84546b5 (patch)
tree8d0069f720f65107a4d46cceac3e61c40779ea23
parent15f23f8b99b2e5ce48e7146c61d4d61b451875ad (diff)
allow linkBox to render without being in a documentview.
-rw-r--r--src/client/views/nodes/LinkBox.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/LinkBox.tsx b/src/client/views/nodes/LinkBox.tsx
index 4f1d12c9b..3cbbbdeff 100644
--- a/src/client/views/nodes/LinkBox.tsx
+++ b/src/client/views/nodes/LinkBox.tsx
@@ -72,8 +72,9 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
const a = this.anchor1;
const b = this.anchor2;
this._forceAnimate;
+ const docView = this._props.docViewPath().lastElement();
- if (a && b && !LightboxView.Contains(this.DocumentView?.())) {
+ if (a && b && !LightboxView.Contains(docView)) {
// text selection bounds are not directly observable, so we have to
// force an update when anything that could affect them changes (text edits causing reflow, scrolling)
a.Document[a.LayoutFieldKey];
@@ -83,7 +84,7 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
const axf = a.screenToViewTransform(); // these force re-render when a or b moves (so do NOT remove)
const bxf = b.screenToViewTransform();
- const scale = a.CollectionFreeFormView === this.DocumentView?.().CollectionFreeFormView ? axf.Scale : bxf.Scale;
+ const scale = !docView ? 1 : a.CollectionFreeFormView === docView.CollectionFreeFormView ? axf.Scale : bxf.Scale;
const at = a.getBounds?.transition; // these force re-render when a or b change size and at the end of an animated transition
const bt = b.getBounds?.transition; // inquring getBounds() also causes text anchors to update whether or not they reflow (any size change triggers an invalidation)
@@ -154,7 +155,7 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps>() {
paddingRight: 4,
paddingTop: 3,
paddingBottom: 3,
- background: DashColor((!this.DocumentView?.().isSelected() && highlightColor) || color)
+ background: DashColor((!docView?.isSelected() && highlightColor) || color)
.fade(0.5)
.toString(),
}}>