From d2cc316130f0d1b77bdfae80c9cf89a82b3b28b6 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 31 Jul 2026 21:32:39 -0700 Subject: [PATCH] [eric] canvas: floor the boot fit, a restored dashboard came back at 29% with nothing readable --- .../pages/Dashboard/hooks/interaction/useCanvasControls.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/pages/Dashboard/hooks/interaction/useCanvasControls.ts b/frontend/src/app/pages/Dashboard/hooks/interaction/useCanvasControls.ts index b61c88a0..59f798be 100644 --- a/frontend/src/app/pages/Dashboard/hooks/interaction/useCanvasControls.ts +++ b/frontend/src/app/pages/Dashboard/hooks/interaction/useCanvasControls.ts @@ -643,7 +643,10 @@ export function useCanvasControls(zoomSensitivity: number = 50, contentBounds?: }; }, []); - const fitToView = useCallback(() => { + // minZoom is for the AUTOMATIC boot fit only: restoring a dashboard that had grown tall used to land + // at 29% with nothing readable, the same illness revealZoom cured on spawn. The toolbar's own Fit + // button passes nothing and still fits everything, however far out that is. + const fitToView = useCallback((minZoom?: number) => { const viewport = viewportRef.current; const content = contentRef.current; if (!viewport || !content) return; @@ -677,7 +680,7 @@ export function useCanvasControls(zoomSensitivity: number = 50, contentBounds?: const contentHeight = maxY - minY; const availW = vRect.width - FIT_PADDING * 2; const availH = vRect.height - FIT_PADDING * 2; - const newZoom = clamp(Math.min(availW / contentWidth, availH / contentHeight), MIN_ZOOM, MAX_ZOOM); + const newZoom = clamp(Math.min(availW / contentWidth, availH / contentHeight), Math.max(MIN_ZOOM, minZoom ?? MIN_ZOOM), MAX_ZOOM); const newPanX = (vRect.width - contentWidth * newZoom) / 2 - minX * newZoom; const newPanY = (vRect.height - contentHeight * newZoom) / 2 - minY * newZoom;