aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-11-19 15:30:53 -0500
committerbobzel <zzzman@gmail.com>2023-11-19 15:30:53 -0500
commit3d18fc27f55c993de9c61297428690aa9c49184f (patch)
treec3b207dede28eed4a332040e38ffc2200c7b012e /src
parenta6b0fd0612667404dfc92052723d4a1ec5d9d72c (diff)
restored shallow observable to prevent pivot views from crashing.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx2
-rw-r--r--src/client/views/nodes/DocumentView.tsx8
2 files changed, 3 insertions, 7 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index ba4e30a9b..45af1064a 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -104,7 +104,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
return (this.props.viewField ?? '') + '_freeform_autoReset';
}
- @observable _layoutElements: ViewDefResult[] = [];
+ @observable.shallow _layoutElements: ViewDefResult[] = []; // shallow because some layout items (eg pivot labels) are just generated 'divs' and can't be frozen as observables
@observable _panZoomTransition: number = 0; // sets the pan/zoom transform ease time- used by nudge(), focus() etc to smoothly zoom/pan. set to 0 to use document's transition time or default of 0
@observable _firstRender = false; // this turns off rendering of the collection's content so that there's instant feedback when a tab is switched of what content will be shown. could be used for performance improvement
@observable _showAnimTimeline = false;
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 66a431bf0..0d6b88392 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1534,10 +1534,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
if (this.docView._componentView?.screenBounds?.()) {
return this.docView._componentView.screenBounds();
}
- const xf = this.docView.props
- .ScreenToLocalTransform()
- .scale(this.trueNativeWidth() ? this.nativeScaling : 1)
- .inverse();
+ const xf = this.docView.props.ScreenToLocalTransform().scale(this.nativeScaling).inverse();
const [[left, top], [right, bottom]] = [xf.transformPoint(0, 0), xf.transformPoint(this.panelWidth, this.panelHeight)];
if (this.docView.props.LayoutTemplateString?.includes(LinkAnchorBox.name)) {
@@ -1617,12 +1614,11 @@ export class DocumentView extends React.Component<DocumentViewProps> {
PanelHeight = () => this.panelHeight;
NativeDimScaling = () => this.nativeScaling;
selfView = () => this;
- trueNativeWidth = () => returnVal(this.props.NativeWidth?.(), Doc.NativeWidth(this.layoutDoc, this.props.DataDoc, false));
screenToLocalTransform = () =>
this.props
.ScreenToLocalTransform()
.translate(-this.centeringX, -this.centeringY)
- .scale(this.trueNativeWidth() ? 1 / this.nativeScaling : 1);
+ .scale(1 / this.nativeScaling);
@action
componentDidMount() {