aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentDecorations.tsx
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/client/views/DocumentDecorations.tsx
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/client/views/DocumentDecorations.tsx')
-rw-r--r--src/client/views/DocumentDecorations.tsx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index a94bee7cb..69c2467a3 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -607,8 +607,10 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
if (nwidth && nheight && !cornerReflow && !horizontalReflow && !verticalReflow) {
scale.x === 1 ? (scale.x = scale.y) : (scale.y = scale.x);
}
+ if (NumCast(doc._height) * scale.y < NumCast(doc._height_min, 10)) scale.y = NumCast(doc._height_min, 10) / NumCast(doc._height);
+ if (NumCast(doc._width) * scale.x < NumCast(doc._width_min, 25)) scale.x = NumCast(doc._width_min, 25) / NumCast(doc._width);
- if ((horizontalReflow || cornerReflow) && Doc.NativeWidth(doc)) {
+ if ((horizontalReflow || cornerReflow) && Doc.NativeWidth(doc) && scale.x > 0) {
const setData = Doc.NativeWidth(doc[DocData]) === doc.nativeWidth;
doc._nativeWidth = scale.x * Doc.NativeWidth(doc);
if (setData) Doc.SetNativeWidth(doc[DocData], NumCast(doc.nativeWidth));
@@ -616,25 +618,23 @@ export class DocumentDecorations extends ObservableReactComponent<DocumentDecora
doc._nativeHeight = (initHeight / initWidth) * nwidth; // initializes the nativeHeight for a PDF
}
}
- if ((verticalReflow || cornerReflow) && Doc.NativeHeight(doc)) {
+ if ((verticalReflow || cornerReflow) && Doc.NativeHeight(doc) && scale.y > 0) {
const setData = Doc.NativeHeight(doc[DocData]) === doc.nativeHeight && !doc.layout_reflowVertical;
doc._nativeHeight = scale.y * Doc.NativeHeight(doc);
if (setData) Doc.SetNativeHeight(doc[DocData], NumCast(doc._nativeHeight));
}
- doc._width = Math.max(NumCast(doc._width_min, 25), NumCast(doc._width) * scale.x);
- doc._height = Math.max(NumCast(doc._height_min, 10), NumCast(doc._height) * scale.y);
+ doc._width = NumCast(doc._width) * scale.x;
+ doc._height = NumCast(doc._height) * scale.y;
const { deltaX, deltaY } = this.realignRefPt(doc, refCent, initWidth || 1, initHeight || 1);
doc.x = NumCast(doc.x) + deltaX;
doc.y = NumCast(doc.y) + deltaY;
doc._layout_modificationDate = new DateField();
- if (scale.y !== 1) {
- const docLayout = docView.layoutDoc;
- docLayout._layout_autoHeight = undefined;
- if (docView.layoutDoc._layout_autoHeight) {
- // if autoHeight is still on because of a prototype
- docLayout._layout_autoHeight = false; // then don't inherit, but explicitly set it to false
+ if (scale.y !== 1 && !opts.freezeNativeDims) {
+ doc._layout_autoHeight = undefined;
+ if (doc._layout_autoHeight) {
+ doc._layout_autoHeight = false; // set explicitly to false if inherited from parent of layout
}
}
}