From 3efe20d11332df95237c13a11fa99918552ed290 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 27 May 2025 11:29:47 -0400 Subject: fixed resetting autoheight by dragging up to work when nativewidth's are set. fixed autoheight on text to work properly when native dims are set. fixed templates to support native witdths and heights. --- src/fields/Doc.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/fields') diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index e110550e6..366dc6a20 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1202,14 +1202,14 @@ export namespace Doc { } export function NativeWidth(doc?: Doc, dataDoc?: Doc, useWidth?: boolean) { // if this is a field template, then don't use the doc's nativeWidth/height - return !doc ? 0 : NumCast(doc.isTemplateForField ? undefined : doc._nativeWidth, NumCast((dataDoc || doc)[Doc.LayoutDataKey(doc) + '_nativeWidth'], !doc.isTemplateForField && useWidth ? NumCast(doc._width) : 0)); + return !doc ? 0 : NumCast(doc._nativeWidth, NumCast((dataDoc || doc)[Doc.LayoutDataKey(doc) + '_nativeWidth'], useWidth ? NumCast(doc._width) : 0)); } export function NativeHeight(doc?: Doc, dataDoc?: Doc, useHeight?: boolean) { if (!doc) return 0; 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.LayoutDataKey(doc) + '_nativeHeight'], useHeight ? NumCast(doc._height) : 0); // if this is a field template, then don't use the doc's nativeWidth/height - return NumCast(doc.isTemplateForField ? undefined : doc._nativeHeight, nheight || dheight); + return NumCast(doc._nativeHeight, nheight || dheight); } export function OutpaintingWidth(doc?: Doc, dataDoc?: Doc, useWidth?: boolean) { @@ -1479,7 +1479,6 @@ export namespace Doc { layoutDoc._nativeWidth = undefined; layoutDoc._nativeHeight = undefined; } else { - layoutDoc._layout_autoHeight = false; if (!Doc.NativeWidth(layoutDoc)) { layoutDoc._nativeWidth = NumCast(layoutDoc._width, panelWidth); layoutDoc._nativeHeight = NumCast(layoutDoc._height, panelHeight); -- cgit v1.2.3-70-g09d2