From 5db6cab5f66864f0a0f682dcdfda08f9e6730a0c Mon Sep 17 00:00:00 2001 From: xxiaoxiong <2482929840@qq.com> Date: Thu, 28 May 2026 21:11:46 +0800 Subject: [PATCH] fix: simplify PPT preview zoom to use direct scaling Replace the inverse-scale technique (width: 100/scale%, transform: scale()) with direct scaling (width: 100%, transform: scale()). The previous approach caused the container size to shrink as zoom increased, which could affect pagination controls and other overlay elements that depend on container dimensions. The new approach: - Sets container to 100% width/height - Applies transform: scale() directly - Keeps zoom direction intuitive (+ enlarges, - shrinks) - Prevents pagination controls from scaling with content Fixes #3177 --- apps/web/src/components/FileViewer.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/FileViewer.tsx b/apps/web/src/components/FileViewer.tsx index 8bf658215..3c62ecc64 100644 --- a/apps/web/src/components/FileViewer.tsx +++ b/apps/web/src/components/FileViewer.tsx @@ -516,8 +516,8 @@ function previewScaleShellStyle( ): CSSProperties & Record { if (viewport === 'desktop') { return { - width: `${100 / previewScale}%`, - height: `${100 / previewScale}%`, + width: '100%', + height: '100%', transform: `scale(${previewScale})`, transformOrigin: '0 0', }; @@ -537,8 +537,8 @@ function manualEditPreviewShellStyle( ): CSSProperties & Record { if (viewport === 'desktop' && frozenWidth) { return { - width: `${frozenWidth / previewScale}px`, - height: `${100 / previewScale}%`, + width: `${frozenWidth}px`, + height: '100%', transform: `scale(${previewScale})`, transformOrigin: '0 0', };