update
This commit is contained in:
@@ -67,6 +67,9 @@ export class DePage extends DeesElement {
|
||||
accessor documentSettings: plugins.shared.interfaces.IDocumentSettings =
|
||||
defaultDocumentSettings;
|
||||
|
||||
@property({ type: Number })
|
||||
accessor manualZoomLevel: number = null; // null = auto-fit, otherwise percentage
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
domtools.DomTools.setupDomTools();
|
||||
@@ -246,7 +249,8 @@ export class DePage extends DeesElement {
|
||||
super.updated(changedProperties);
|
||||
if (
|
||||
changedProperties.has("viewHeight") ||
|
||||
changedProperties.has("viewWidth")
|
||||
changedProperties.has("viewWidth") ||
|
||||
changedProperties.has("manualZoomLevel")
|
||||
) {
|
||||
this.adjustScaling();
|
||||
}
|
||||
@@ -259,15 +263,21 @@ export class DePage extends DeesElement {
|
||||
if (!scaleWrapper) return;
|
||||
|
||||
let scale = 1;
|
||||
if (this.viewHeight) {
|
||||
|
||||
// If manual zoom is set, use it directly
|
||||
if (this.manualZoomLevel !== null) {
|
||||
scale = this.manualZoomLevel / 100;
|
||||
} else if (this.viewHeight) {
|
||||
// Auto-fit to height
|
||||
scale = this.viewHeight / plugins.shared.A4_HEIGHT;
|
||||
} else if (this.viewWidth) {
|
||||
// Auto-fit to width
|
||||
scale = this.viewWidth / plugins.shared.A4_WIDTH;
|
||||
}
|
||||
|
||||
scaleWrapper.style.transform = `scale(${scale})`;
|
||||
|
||||
// Adjust the outer dimensions so they match the scaled content
|
||||
|
||||
this.style.width = `${plugins.shared.A4_WIDTH * scale}px`;
|
||||
this.style.height = `${plugins.shared.A4_HEIGHT * scale}px`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user