Skip to content

Commit

Permalink
do not use .defaultPrevented
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Nov 4, 2024
1 parent e11259f commit c42e52b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
11 changes: 3 additions & 8 deletions packages/uikit/src/components/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export function computedSelectionHandlers(
}
return {
onPointerDown: (e) => {
if (dragState != null || e.defaultPrevented || e.uv == null || instancedTextRef.current == null) {
if (dragState != null || e.uv == null || instancedTextRef.current == null) {
return
}
cancelBlur(e.nativeEvent)
Expand All @@ -372,7 +372,7 @@ export function computedSelectionHandlers(
setTimeout(() => focus(startCharIndex, startCharIndex))
},
onDoubleClick: (e) => {
if (segmenter == null || e.defaultPrevented || e.uv == null || instancedTextRef.current == null) {
if (segmenter == null || e.uv == null || instancedTextRef.current == null) {
return
}
e.stopImmediatePropagation?.()
Expand All @@ -396,12 +396,7 @@ export function computedSelectionHandlers(
onPointerLeave: onPointerFinish,
onPointerCancel: onPointerFinish,
onPointerMove: (e) => {
if (
dragState?.pointerId != e.pointerId ||
e.defaultPrevented ||
e.uv == null ||
instancedTextRef.current == null
) {
if (dragState?.pointerId != e.pointerId || e.uv == null || instancedTextRef.current == null) {
return
}
e.stopImmediatePropagation?.()
Expand Down
2 changes: 0 additions & 2 deletions packages/uikit/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Intersection } from 'three'

export type ThreeEvent<TSourceEvent> = Intersection & {
nativeEvent: TSourceEvent
defaultPrevented?: boolean
stopped?: boolean
stopPropagation?: () => void
stopImmediatePropagation?: () => void
} & (TSourceEvent extends { pointerId: number } ? { pointerId: number } : {})
Expand Down
6 changes: 0 additions & 6 deletions packages/uikit/src/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ export function computedScrollHandlers(
onPointerLeave: onPointerFinish,
onPointerCancel: onPointerFinish,
onPointerMove: (event) => {
if (event.defaultPrevented) {
return
}
const prevInteraction = downPointerMap.get(event.pointerId)
if (prevInteraction == null) {
return
Expand Down Expand Up @@ -277,9 +274,6 @@ export function computedScrollHandlers(
prevInteraction.timestamp = timestamp
},
onWheel: (event) => {
if (event.defaultPrevented) {
return
}
const { nativeEvent } = event
scroll(event, nativeEvent.deltaX, nativeEvent.deltaY, undefined, false)
},
Expand Down

0 comments on commit c42e52b

Please sign in to comment.