aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-02-22 18:05:36 -0500
committerbobzel <zzzman@gmail.com>2022-02-22 18:05:36 -0500
commit2ec32aee559749e1978d779705c84a8343615bfe (patch)
tree8ed6152ed19d602b2e95fd1272dae55a82a96001 /src/client/views/nodes/DocumentView.tsx
parent8e48615d332da20b07abe8b1fa37762f665fa003 (diff)
improve efficiency for scenes with lots of documents by using computed functions to avoid invalidations. moved grid renderer to its own component to avoid invalidations when panning/zooming.
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 91f2359af..6468913fb 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -986,7 +986,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
captionStyleProvider = (doc: Opt<Doc>, props: Opt<DocumentViewInternalProps>, property: string) => this.props?.styleProvider?.(doc, props, property + ":caption");
@computed get innards() {
TraceMobx();
- const ffscale = (this.props.DocumentView().props.CollectionFreeFormDocumentView?.().props.ScreenToLocalTransform().Scale || 1);
+ const ffscale = () => (this.props.DocumentView().props.CollectionFreeFormDocumentView?.().props.ScreenToLocalTransform().Scale || 1);
const showTitle = this.ShowTitle?.split(":")[0];
const showTitleHover = this.ShowTitle?.includes(":hover");
const showCaption = !this.props.hideCaptions && this.Document._viewType !== CollectionViewType.Carousel ? StrCast(this.layoutDoc._showCaption) : undefined;
@@ -994,14 +994,14 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
<div className="documentView-captionWrapper"
style={{
pointerEvents: this.onClickHandler || this.Document.ignoreClick ? "none" : this.isContentActive() || this.props.isDocumentActive?.() ? "all" : undefined,
- minWidth: 50 * ffscale,
- maxHeight: `max(100%, ${20 * ffscale}px)`
+ minWidth: 50 * ffscale(),
+ maxHeight: `max(100%, ${20 * ffscale()}px)`
}}>
<FormattedTextBox {...OmitKeys(this.props, ['children']).omit}
yPadding={10}
xPadding={10}
fieldKey={showCaption}
- fontSize={12 * Math.max(1, 2 * ffscale / 3)}
+ fontSize={12 * Math.max(1, 2 * ffscale() / 3)}
styleProvider={this.captionStyleProvider}
dontRegisterView={true}
noSidebar={true}