aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-05-27 11:29:47 -0400
committerbobzel <zzzman@gmail.com>2025-05-27 11:29:47 -0400
commit3efe20d11332df95237c13a11fa99918552ed290 (patch)
tree81fe119072d44851aed6fe8a18fa9a06549c849a /src/fields/Doc.ts
parenta98099cc968b6da408ea3a7bf92c657529eb4626 (diff)
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.
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts5
1 files changed, 2 insertions, 3 deletions
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);