Skip to content

Commit

Permalink
make emitMove of pointer.commit a required property to prevent overla…
Browse files Browse the repository at this point in the history
…p with the optional computeActivePointer from combined pointer
  • Loading branch information
bbohlender committed Nov 13, 2024
1 parent c658821 commit 469bd64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/pointer-events/src/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export class CombinedPointer {
/**
* only for internal use
*/
commit(nativeEvent: NativeEvent, computeActivePointer: boolean = true): void {
commit(nativeEvent: NativeEvent, emitMove: boolean, computeActivePointer: boolean = true): void {
if (this.enableMultiplePointers) {
const length = this.pointers.length
for (let i = 0; i < length; i++) {
this.pointers[i].commit(nativeEvent)
this.pointers[i].commit(nativeEvent, emitMove)
}
return
}
Expand All @@ -111,7 +111,7 @@ export class CombinedPointer {
for (let i = 0; i < length; i++) {
const pointer = this.pointers[i]
pointer.setEnabled(pointer === this.activePointer, nativeEvent, false)
pointer.commit(nativeEvent, false)
pointer.commit(nativeEvent, emitMove, false)
}
}

Expand All @@ -138,7 +138,7 @@ export class CombinedPointer {
}

//commit the intersection, compute active pointers, and enabling/disabling pointers
this.commit(nativeEvent)
this.commit(nativeEvent, true)
}

setEnabled(enabled: boolean, nativeEvent: NativeEvent): void {
Expand Down
8 changes: 4 additions & 4 deletions packages/pointer-events/src/pointer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class Pointer {
}
this.enabled = enabled
if (commit) {
this.commit(nativeEvent)
this.commit(nativeEvent, false)
}
}

Expand All @@ -192,7 +192,7 @@ export class Pointer {
this.intersection = intersection
}

commit(nativeEvent: NativeEvent, emitMove: boolean = true) {
commit(nativeEvent: NativeEvent, emitMove: boolean) {
const camera = this.getCamera()
const prevIntersection = this.prevEnabled ? this.prevIntersection : undefined
const intersection = this.enabled ? this.intersection : undefined
Expand Down Expand Up @@ -250,7 +250,7 @@ export class Pointer {
*/
move(scene: Object3D, nativeEvent: NativeEvent): void {
this.intersection = this.computeIntersection(scene, nativeEvent)
this.commit(nativeEvent)
this.commit(nativeEvent, true)
}

/**
Expand Down Expand Up @@ -398,7 +398,7 @@ export class Pointer {
this.pointerCapture = undefined
}
this.intersection = undefined
this.commit(nativeEvent)
this.commit(nativeEvent, false)
}
this.onFirstMove.length = 0
this.wasMoved = false
Expand Down

0 comments on commit 469bd64

Please sign in to comment.