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 --- .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 4 ++-- src/client/views/nodes/CollectionFreeFormDocumentView.tsx | 10 +++++----- src/fields/Doc.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 2e66c9012..7f8bde9b4 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1289,8 +1289,8 @@ export class CollectionFreeFormView extends CollectionSubView 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])); diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 368aaa5db..e2746091e 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1059,7 +1059,7 @@ export namespace Doc { } export function NativeHeight(doc?: Doc, dataDoc?: Doc, useHeight?: boolean) { if (!doc) return 0; - const nheight = (Doc.NativeWidth(doc, dataDoc, useHeight) * NumCast(doc._height)) / NumCast(doc._width); + const nheight = (Doc.NativeWidth(doc, dataDoc, useHeight) / NumCast(doc._width)) * NumCast(doc._height); // divide before multiply to avoid floating point errrorin case nativewidth = width const dheight = NumCast((dataDoc || doc)[Doc.LayoutFieldKey(doc) + '_nativeHeight'], useHeight ? NumCast(doc._height) : 0); return NumCast(doc._nativeHeight, nheight || dheight); } -- cgit v1.2.3-70-g09d2