Skip to content

Commit

Permalink
CLICK in the hit area, but allow panning everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jboolean committed Dec 21, 2024
1 parent 4e6cb86 commit 8e6f073
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/screens/App/screens/ViewerPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ const ZOOM_PAN_PINCH_EVENT_TYPES = [
'mouseenter',
'keyup',
'keydown',
'click',
// 'click',
] as const;

const HIT_AREA_EVENT_TYPES = ['pointerdown', 'click'] as const;

const INITIAL_SCALE = 1.05;

export default function ViewerPane({
Expand All @@ -64,11 +66,13 @@ export default function ViewerPane({
// The overlay is on top and normally would capture all events, but we also need the zooming wrapper to see these events
// This hook forwards events from the overlay to the wrapper
useEventForwarding(
zoomHitAreaEl,
overlayRef.current,
wrapperComponent,
ZOOM_PAN_PINCH_EVENT_TYPES
);

useEventForwarding(zoomHitAreaEl, wrapperComponent, HIT_AREA_EVENT_TYPES);

// Reset the transform when the photo changes
useEffect(() => {
if (wrapperRef.current) wrapperRef.current.resetTransform();
Expand Down

0 comments on commit 8e6f073

Please sign in to comment.