diff --git a/src/components/canvas/CanvasGestureLayer.tsx b/src/components/canvas/CanvasGestureLayer.tsx index cba5efa..e9fc51d 100644 --- a/src/components/canvas/CanvasGestureLayer.tsx +++ b/src/components/canvas/CanvasGestureLayer.tsx @@ -166,8 +166,12 @@ function useCanvasGestures({ y: state.xy[1], }), ); + const isQualifiedTap = + state.tap && + (gestureInputEventRef.current.inputType === 'touch' || + gestureInputEventRef.current.inputType === 'mouse1'); if (isObjectOrToolGestureClaim() && gestureState.claimedBy) { - if (state.tap) { + if (isQualifiedTap) { canvas.onClaimedTap(gestureInputEventRef.current); } canvas.onClaimedDragEnd(gestureInputEventRef.current); @@ -183,7 +187,7 @@ function useCanvasGestures({ if (!gestureInputEventRef.current.defaultPrevented) { defaultOnDragEnd(gestureInputEventRef.current, canvas); } - } else { + } else if (isQualifiedTap) { canvas.onCanvasTap(gestureInputEventRef.current); onTap?.(gestureInputEventRef.current, canvas); if (!gestureInputEventRef.current.defaultPrevented) { diff --git a/src/components/viewport/viewportHooks.ts b/src/components/viewport/viewportHooks.ts index 23aefd2..309d9b1 100644 --- a/src/components/viewport/viewportHooks.ts +++ b/src/components/viewport/viewportHooks.ts @@ -10,7 +10,6 @@ import { useStableCallback } from '../../hooks.js'; import { Viewport } from '../../logic/Viewport.js'; import { Vector2 } from '../../types.js'; import { gestureState } from '../gestures/useGestureState.js'; -import { isMiddleClick, isRightClick } from '@a-type/utils'; /** * Tracks cursor position and sends updates to the socket connection @@ -158,18 +157,8 @@ export function useViewportGestureControls( const bindPassiveGestures = useGesture( { onDrag: (state) => { - // viewport drag is middle click only - if (!('button' in state.event) || !isMiddleClick(state.event)) { - return; - } - // ignore gestures claimed by objects or regions if (gestureState.claimType) { - console.debug( - 'ignoring drag claimed by', - gestureState.claimType, - gestureState.claimedBy, - ); return; }