From 7e2395884e9818b07622ef3869d86cb55f1cc20d Mon Sep 17 00:00:00 2001 From: James Vaughan Date: Wed, 26 Oct 2022 05:50:58 -0700 Subject: [PATCH] Call onPointerUp on right pointer up (#1008) * Call onPointerUp on right pointer up * Set pointer capture on right point events on the canvas --- packages/core/src/hooks/useCanvasEvents.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/core/src/hooks/useCanvasEvents.tsx b/packages/core/src/hooks/useCanvasEvents.tsx index 61ef1d5ce..b357c0084 100644 --- a/packages/core/src/hooks/useCanvasEvents.tsx +++ b/packages/core/src/hooks/useCanvasEvents.tsx @@ -11,14 +11,14 @@ export function useCanvasEvents() { else (e as any).dead = true if (!inputs.pointerIsValid(e)) return + e.currentTarget.setPointerCapture(e.pointerId) + // On right click if (e.button === 2) { callbacks.onRightPointCanvas?.(inputs.pointerDown(e, 'canvas'), e) return } - e.currentTarget.setPointerCapture(e.pointerId) - const info = inputs.pointerDown(e, 'canvas') // On left click down @@ -54,13 +54,14 @@ export function useCanvasEvents() { inputs.activePointer = undefined if (!inputs.pointerIsValid(e)) return + const info = inputs.pointerUp(e, 'canvas') + // On right click up if (e.button === 2) { + callbacks.onPointerUp?.(info, e) return } - const info = inputs.pointerUp(e, 'canvas') - const isDoubleClick = inputs.isDoubleClick() // Release pointer capture, if any