aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index bd71115db..90edab3a7 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -743,6 +743,12 @@ export class DocumentViewInternal extends DocComponent<DocumentViewProps & Field
widgetOverlayFunc = () => (this.widgetDecorations ? this.widgetOverlay : null);
viewingAiEditor = () => (this._props.showAIEditor && this._componentView?.componentAIView?.() !== undefined ? this.aiEditor : null);
@observable _contentsRef: DocumentContentsView | undefined = undefined;
+ screenToContentsXf = () =>
+ this.viewingAiEditor()
+ ? this.layoutDoc.layout_reflowHorizontal
+ ? this._props.ScreenToLocalTransform().scale(Math.min(this.aiContentsWidth() / this._props.PanelWidth(), this.aiContentsHeight() / this._props.PanelHeight()))
+ : this._props.ScreenToLocalTransform().translate((this._props.PanelWidth() - this.aiContentsWidth()) / 2, 0)
+ : this._props.ScreenToLocalTransform();
@computed get viewBoxContents() {
TraceMobx();
const isInk = this.layoutDoc._layout_isSvg && !this._props.LayoutTemplateString;
@@ -762,6 +768,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewProps & Field
layoutFieldKey={StrCast(this.Document.layout_fieldKey, 'layout')}
pointerEvents={this.contentPointerEvents}
setContentViewBox={this.setContentView}
+ ScreenToLocalTransform={this.screenToContentsXf}
childFilters={this.childFilters}
PanelWidth={this.viewingAiEditor() ? this.aiContentsWidth : this._props.PanelWidth}
PanelHeight={this.viewingAiEditor() ? this.aiContentsHeight : this.panelHeight}