From e3dd317c8afc0f748ff6ee0d81e9e6db9044875a Mon Sep 17 00:00:00 2001 From: Cyril Date: Mon, 13 Jul 2026 16:00:01 +0200 Subject: [PATCH] =?UTF-8?q?fixup!=20=E2=9C=A8(frontend)=20add=20useScreenS?= =?UTF-8?q?hareZoom=20hook=20for=20zoom=20and=20pan=20state=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rooms/livekit/hooks/useScreenShareZoom.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts b/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts index 21f002dc..296595f6 100644 --- a/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts +++ b/src/frontend/src/features/rooms/livekit/hooks/useScreenShareZoom.ts @@ -79,14 +79,20 @@ export function useScreenShareZoom() { ) const handleWheel = useCallback( - (e: React.WheelEvent) => { - // Match browser zoom gesture (Ctrl/Cmd + scroll). + (e: WheelEvent) => { if (!e.ctrlKey && !e.metaKey) return e.preventDefault() e.stopPropagation() + const target = e.currentTarget as HTMLElement const delta = -e.deltaY * WHEEL_ZOOM_SPEED + const rect = target.getBoundingClientRect() + const cursorXPercent = + ((e.clientX - rect.left) / rect.width) * 100 - PAN_CLAMP_HALF + const cursorYPercent = + ((e.clientY - rect.top) / rect.height) * 100 - PAN_CLAMP_HALF + setZoomLevel((prev) => { const next = clampZoom(prev + delta) @@ -95,12 +101,6 @@ export function useScreenShareZoom() { return MIN_ZOOM } - const rect = e.currentTarget.getBoundingClientRect() - const cursorXPercent = - ((e.clientX - rect.left) / rect.width) * 100 - PAN_CLAMP_HALF - const cursorYPercent = - ((e.clientY - rect.top) / rect.height) * 100 - PAN_CLAMP_HALF - setPanOffset((pan) => { const zoomRatio = next / prev return clampPan(