Call onPointerUp on right pointer up (#1008)

* Call onPointerUp on right pointer up

* Set pointer capture on right point events on the canvas
This commit is contained in:
James Vaughan 2022-10-26 05:50:58 -07:00 committed by GitHub
parent 6bbff94464
commit 7e2395884e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,14 +11,14 @@ export function useCanvasEvents() {
else (e as any).dead = true else (e as any).dead = true
if (!inputs.pointerIsValid(e)) return if (!inputs.pointerIsValid(e)) return
e.currentTarget.setPointerCapture(e.pointerId)
// On right click // On right click
if (e.button === 2) { if (e.button === 2) {
callbacks.onRightPointCanvas?.(inputs.pointerDown(e, 'canvas'), e) callbacks.onRightPointCanvas?.(inputs.pointerDown(e, 'canvas'), e)
return return
} }
e.currentTarget.setPointerCapture(e.pointerId)
const info = inputs.pointerDown(e, 'canvas') const info = inputs.pointerDown(e, 'canvas')
// On left click down // On left click down
@ -54,13 +54,14 @@ export function useCanvasEvents() {
inputs.activePointer = undefined inputs.activePointer = undefined
if (!inputs.pointerIsValid(e)) return if (!inputs.pointerIsValid(e)) return
const info = inputs.pointerUp(e, 'canvas')
// On right click up // On right click up
if (e.button === 2) { if (e.button === 2) {
callbacks.onPointerUp?.(info, e)
return return
} }
const info = inputs.pointerUp(e, 'canvas')
const isDoubleClick = inputs.isDoubleClick() const isDoubleClick = inputs.isDoubleClick()
// Release pointer capture, if any // Release pointer capture, if any