Fix context menu bug on mobile
This commit is contained in:
parent
5b13e7f19e
commit
f2481642f9
5 changed files with 8 additions and 5 deletions
|
@ -1,7 +1,5 @@
|
|||
import type { TLBinding } from '@tldraw/core'
|
||||
import { nanoid } from 'nanoid'
|
||||
import type { Shape } from 'shapes'
|
||||
import type { ArrowShape } from 'shapes/arrow'
|
||||
import type { CustomBinding } from './constants'
|
||||
import type { machine } from './machine'
|
||||
|
||||
|
|
|
@ -21,10 +21,11 @@ export function useBoundsEvents() {
|
|||
callbacks.onPointerDown?.(info, e)
|
||||
},
|
||||
onPointerUp: (e: React.PointerEvent) => {
|
||||
if ((e as any).dead) return
|
||||
else (e as any).dead = true
|
||||
if (e.button !== 0) return
|
||||
inputs.activePointer = undefined
|
||||
if (!inputs.pointerIsValid(e)) return
|
||||
e.stopPropagation()
|
||||
const isDoubleClick = inputs.isDoubleClick()
|
||||
const info = inputs.pointerUp(e, 'bounds')
|
||||
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
||||
|
|
|
@ -28,6 +28,8 @@ export function useCanvasEvents() {
|
|||
callbacks.onPointerMove?.(info, e)
|
||||
},
|
||||
onPointerUp: (e: React.PointerEvent) => {
|
||||
if ((e as any).dead) return
|
||||
else (e as any).dead = true
|
||||
if (e.button !== 0 && e.button !== 1) return
|
||||
inputs.activePointer = undefined
|
||||
if (!inputs.pointerIsValid(e)) return
|
||||
|
|
|
@ -18,9 +18,10 @@ export function useHandleEvents(id: string) {
|
|||
callbacks.onPointerDown?.(info, e)
|
||||
},
|
||||
onPointerUp: (e: React.PointerEvent) => {
|
||||
if ((e as any).dead) return
|
||||
else (e as any).dead = true
|
||||
if (e.button !== 0) return
|
||||
if (!inputs.pointerIsValid(e)) return
|
||||
e.stopPropagation()
|
||||
const isDoubleClick = inputs.isDoubleClick()
|
||||
const info = inputs.pointerUp(e, id)
|
||||
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
||||
|
|
|
@ -36,10 +36,11 @@ export function useShapeEvents(id: string) {
|
|||
callbacks.onPointerDown?.(info, e)
|
||||
},
|
||||
onPointerUp: (e: React.PointerEvent) => {
|
||||
if ((e as any).dead) return
|
||||
else (e as any).dead = true
|
||||
if (e.button !== 0) return
|
||||
inputs.activePointer = undefined
|
||||
if (!inputs.pointerIsValid(e)) return
|
||||
e.stopPropagation()
|
||||
const isDoubleClick = inputs.isDoubleClick()
|
||||
const info = inputs.pointerUp(e, id)
|
||||
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
||||
|
|
Loading…
Reference in a new issue