[fix] right click (#1891)

This PR fixes right clicks.

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Right click a shape. The context menu should show information
relevant to the shape.
2. Lock a shape.
3. Right click to get to the unlock from the context menu.
This commit is contained in:
Steve Ruiz 2023-09-18 16:00:38 +01:00 committed by GitHub
parent beb9db8eb7
commit 10f6818a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,17 @@ export function useCanvasEvents() {
function onPointerDown(e: React.PointerEvent) {
if ((e as any).isKilled) return
if (e.button === 2) {
editor.dispatch({
type: 'pointer',
target: 'canvas',
name: 'right_click',
...getPointerInfo(e),
})
return
}
if (e.button !== 0 && e.button !== 1 && e.button !== 5) return
setPointerCapture(e.currentTarget, e)