From ac360607bee82f0fef769eada99dc0b3f85ae70a Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 27 Nov 2023 13:46:27 -0500 Subject: fixed dataView to not lose focus when typing 'enter' by fixing freeformdocumentview panelwidth() to --- src/client/views/nodes/CollectionFreeFormDocumentView.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/views/nodes/CollectionFreeFormDocumentView.tsx') diff --git a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx index 421d431b3..dd16ab71b 100644 --- a/src/client/views/nodes/CollectionFreeFormDocumentView.tsx +++ b/src/client/views/nodes/CollectionFreeFormDocumentView.tsx @@ -1,4 +1,4 @@ -import { action, computed, observable, trace } from 'mobx'; +import { action, computed, observable } from 'mobx'; import { observer } from 'mobx-react'; import { Doc, Opt } from '../../../fields/Doc'; import { List } from '../../../fields/List'; @@ -20,8 +20,8 @@ export interface CollectionFreeFormDocumentViewWrapperProps extends DocumentView x: number; y: number; z: number; - width: number; - height: number; + width: number; // -1 means use PanelWidth which should be the same as the Document's width, but avoids the delay of waiting for the width prop to change in PanelWidth function + height: number; // -1 means use PanelHeight zIndex?: number; rotation?: number; color?: string; @@ -72,8 +72,8 @@ export class CollectionFreeFormDocumentViewWrapper extends DocComponent this.Transition; // prettier-ignore w_DataTransition = () => this.DataTransition; // prettier-ignore - PanelWidth = () => this.Width || this.props.PanelWidth?.(); // prettier-ignore - PanelHeight = () => this.Height || this.props.PanelHeight?.(); // prettier-ignore + PanelWidth = () => this.Width > 0 ? this.Width : this.props.PanelWidth?.(); // prettier-ignore + PanelHeight = () => this.Height > 0 ? this.Height : this.props.PanelHeight?.(); // prettier-ignore @action componentDidUpdate() { this.WrapperKeys.forEach(keys => ((this as any)[keys.upper] = (this.props as any)[keys.lower])); -- cgit v1.2.3-70-g09d2