From 7a64a6c047a2084ade521e673a9cd252624b83fc Mon Sep 17 00:00:00 2001 From: Ovgodd Date: Tue, 1 Sep 2026 10:23:24 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=99=BB=EF=B8=8F(frontend)=20refacto?= =?UTF-8?q?r=20screen=20share=20zoom=20pan=20with=20useMove=20and=20impera?= =?UTF-8?q?tive=20DOM=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rooms/livekit/hooks/useScreenShareZoom.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts b/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts index 2e5b9cc5..89ba1cf0 100644 --- a/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts +++ b/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts @@ -67,11 +67,10 @@ export const useScreenShareZoom = () => { listenersRef.current.forEach((cb) => cb()) }, []) - const applyTransform = useCallback((transition: boolean) => { + const applyTransform = useCallback(() => { const el = transformElRef.current if (!el) return el.style.transform = getZoomTransform(zoomRef.current, panRef.current) - el.style.transition = transition ? 'transform 150ms ease-out' : 'none' }, []) const applyCursor = useCallback(() => { @@ -87,7 +86,7 @@ export const useScreenShareZoom = () => { const next = clampZoom(zoomRef.current + ZOOM_STEP) zoomRef.current = next panRef.current = clampPan(panRef.current, next) - applyTransform(true) + applyTransform() applyCursor() flush() }, [applyTransform, applyCursor, flush]) @@ -97,7 +96,7 @@ export const useScreenShareZoom = () => { zoomRef.current = next panRef.current = next <= MIN_ZOOM ? { x: 0, y: 0 } : clampPan(panRef.current, next) - applyTransform(true) + applyTransform() applyCursor() flush() }, [applyTransform, applyCursor, flush]) @@ -105,7 +104,7 @@ export const useScreenShareZoom = () => { const resetZoom = useCallback(() => { zoomRef.current = MIN_ZOOM panRef.current = { x: 0, y: 0 } - applyTransform(true) + applyTransform() applyCursor() flush() }, [applyTransform, applyCursor, flush]) @@ -140,7 +139,7 @@ export const useScreenShareZoom = () => { }) } - applyTransform(false) + applyTransform() applyCursor() flush() }, @@ -177,7 +176,7 @@ export const useScreenShareZoom = () => { zoomRef.current ) - applyTransform(false) + applyTransform() // Mouse drag: skip flush (imperative-only) to avoid re-renders per frame. // Keyboard: flush so the toolbar reflects the updated position. if (e.pointerType === 'keyboard') { @@ -186,7 +185,7 @@ export const useScreenShareZoom = () => { }, onMoveEnd() { draggingRef.current = false - applyTransform(true) + applyTransform() applyCursor() flush() }, @@ -198,7 +197,7 @@ export const useScreenShareZoom = () => { { x: panRef.current.x + dx, y: panRef.current.y + dy }, zoomRef.current ) - applyTransform(true) + applyTransform() flush() }, [applyTransform, flush]