From d63fea3fece101a1b7c2e608f720c5cc6f8e3e61 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Thu, 2 Apr 2026 02:55:42 -0400 Subject: [PATCH] fix(pdf-server): let zoom-out button go below fit (revert button floor) Some hosts overlay UI on the iframe (chat composer, etc.) without reporting it in safeAreaInsets.bottom, so computeFitScale's 'fit' fills the iframe but the page bottom sits under the overlay. Flooring the zoom-out button at fit removed the only escape hatch. Pinch keeps the fit floor + rubber-band (it needs a defined snap point for the exit-to-inline gesture). The button now goes to ZOOM_MIN as before #587. --- examples/pdf-server/src/mcp-app.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/pdf-server/src/mcp-app.ts b/examples/pdf-server/src/mcp-app.ts index 7ea0bf4d..deec2e7f 100644 --- a/examples/pdf-server/src/mcp-app.ts +++ b/examples/pdf-server/src/mcp-app.ts @@ -3340,13 +3340,13 @@ function zoomIn() { renderPage().then(scrollSelectionIntoView); } -async function zoomOut() { +function zoomOut() { userHasZoomed = true; - // Fullscreen floor is fit-to-page (anything smaller is dead margin). - const fit = - currentDisplayMode === "fullscreen" ? await computeFitScale() : null; - const floor = fit !== null ? Math.max(ZOOM_MIN, fit) : ZOOM_MIN; - scale = Math.max(scale - 0.25, floor); + // Intentionally NOT floored at fit-to-page (unlike pinch). Hosts may + // overlay UI on the iframe without reporting it in safeAreaInsets, so + // "fit" can leave the page bottom hidden; the button is the escape hatch + // to shrink past it. Pinch still rubber-bands at fit (see commitPinch). + scale = Math.max(scale - 0.25, ZOOM_MIN); renderPage().then(scrollSelectionIntoView); }