update
This commit is contained in:
@@ -548,9 +548,8 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
this.zoomLevel = null;
|
this.zoomLevel = null;
|
||||||
this.updateDisplayZoom();
|
this.updateDisplayZoom();
|
||||||
} else if (value === "fit-width") {
|
} else if (value === "fit-width") {
|
||||||
// Fit width will be handled by auto scaling
|
// Calculate zoom to fit page width to viewport width
|
||||||
this.zoomLevel = null;
|
this.calculateFitWidth();
|
||||||
this.updateDisplayZoom();
|
|
||||||
} else if (value === "fit-page") {
|
} else if (value === "fit-page") {
|
||||||
// Calculate zoom to fit entire page in viewport
|
// Calculate zoom to fit entire page in viewport
|
||||||
this.calculateFitPage();
|
this.calculateFitPage();
|
||||||
@@ -583,6 +582,18 @@ export class DeDocumentViewer extends DeesElement {
|
|||||||
this.pageGap = parseInt((e.target as HTMLInputElement).value, 10);
|
this.pageGap = parseInt((e.target as HTMLInputElement).value, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private calculateFitWidth(): void {
|
||||||
|
const viewport = this.shadowRoot?.querySelector(".viewport");
|
||||||
|
if (!viewport) return;
|
||||||
|
|
||||||
|
// Account for padding and scrollbar width
|
||||||
|
const viewportWidth = viewport.clientWidth - 32 - 16;
|
||||||
|
const scale = viewportWidth / plugins.shared.A4_WIDTH;
|
||||||
|
|
||||||
|
this.zoomLevel = Math.round(scale * 100);
|
||||||
|
this.displayZoom = this.zoomLevel;
|
||||||
|
}
|
||||||
|
|
||||||
private calculateFitPage(): void {
|
private calculateFitPage(): void {
|
||||||
const viewport = this.shadowRoot?.querySelector(".viewport");
|
const viewport = this.shadowRoot?.querySelector(".viewport");
|
||||||
if (!viewport) return;
|
if (!viewport) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user