aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/TabDocView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-03 15:28:53 -0400
committerbobzel <zzzman@gmail.com>2024-05-03 15:28:53 -0400
commit93ab35c251b399f3e44ab2fa016e2af13df5a53b (patch)
tree08e6a720ef7bd652b74d05d74633b4be9070fc83 /src/client/views/collections/TabDocView.tsx
parente77b55c771a2bd3ba49169185edd9ed2099de1c6 (diff)
fixed not having docs being dragged show up in schema view unless it is active.
Diffstat (limited to 'src/client/views/collections/TabDocView.tsx')
-rw-r--r--src/client/views/collections/TabDocView.tsx13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index 2d8b2564d..008ef6ab4 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -93,13 +93,10 @@ export class TabMinimapView extends ObservableReactComponent<TabMinimapViewProps
};
@computed get renderBounds() {
- const compView = this._props.tabView()?.ComponentView as CollectionFreeFormView;
- const bounds = compView?.freeformData?.(true)?.bounds;
- if (!bounds) return undefined;
- const xbounds = bounds.r - bounds.x;
- const ybounds = bounds.b - bounds.y;
- const dim = Math.max(xbounds, ybounds);
- return { l: bounds.x + xbounds / 2 - dim / 2, t: bounds.y + ybounds / 2 - dim / 2, cx: bounds.x + xbounds / 2, cy: bounds.y + ybounds / 2, dim };
+ const cbounds = this._props.tabView()?.ComponentView?.contentBounds?.();
+ const { width, height, bounds, cx, cy } = cbounds ?? { bounds: undefined, width: 0, height: 0 };
+ const dim = Math.max(width, height);
+ return bounds === undefined ? bounds : { l: bounds.x + width / 2 - dim / 2, t: bounds.y + height / 2 - dim / 2, cx, cy, dim };
}
@computed get xPadding() {
return !this.renderBounds ? 0 : Math.max(0, this._props.PanelWidth() / NumCast(this._props.document._freeform_scale, 1) - 2 * (this.renderBounds.cx - this.renderBounds.l));
@@ -127,8 +124,8 @@ export class TabMinimapView extends ObservableReactComponent<TabMinimapViewProps
);
};
popup = () => {
- if (!this.renderBounds) return <div />;
const { renderBounds } = this;
+ if (!renderBounds) return <div />;
const miniWidth = () => (this._props.PanelWidth() / NumCast(this._props.document._freeform_scale, 1) / renderBounds.dim) * 100;
const miniHeight = () => (this._props.PanelHeight() / NumCast(this._props.document._freeform_scale, 1) / renderBounds.dim) * 100;
const miniLeft = () => 50 + ((NumCast(this._props.document._freeform_panX) - renderBounds.cx) / renderBounds.dim) * 100 - miniWidth() / 2;