diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 7d23ee7d..735073e7 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -298,7 +298,8 @@ function App() { const isRotationSet = rotation !== 360; const effectiveRotation = useMemo(() => (isRotationSet ? rotation : (activeVideoStream?.tags?.rotate ? parseInt(activeVideoStream.tags.rotate, 10) : undefined)), [isRotationSet, activeVideoStream, rotation]); - const zoomRel = useCallback((rel: number) => setZoom((z) => Math.min(Math.max(z + (rel * (1 + (z / 10))), 1), zoomMax)), []); + const zoomAbs = useCallback((fn: (v: number) => number) => setZoom((z) => Math.min(Math.max(fn(z), 1), zoomMax)), []); + const zoomRel = useCallback((rel: number) => zoomAbs((z) => z + (rel * (1 + (z / 10)))), [zoomAbs]); const compatPlayerRequired = usingDummyVideo; const compatPlayerWanted = ( isRotationSet @@ -318,11 +319,11 @@ function App() { const timelineToggleComfortZoom = useCallback(() => { if (!comfortZoom) return; - setZoom((prevZoom) => { + zoomAbs((prevZoom) => { if (prevZoom === 1) return comfortZoom; return 1; }); - }, [comfortZoom]); + }, [comfortZoom, zoomAbs]); const maxLabelLength = safeOutputFileName ? 100 : 500; @@ -2539,7 +2540,7 @@ function App() { >, + setZoom: (fn: (z: number) => number) => void, timelineToggleComfortZoom: () => void, isRotationSet: boolean, rotation: number, @@ -457,7 +457,7 @@ function BottomBar({
{Math.floor(zoom)}x
- setZoom(() => parseInt(e.target.value, 10)))}> {zoomOptions.map((val) => (