From 469bd644cf30832e4d518026a1ec848d793d350b Mon Sep 17 00:00:00 2001 From: Bela Bohlender Date: Wed, 13 Nov 2024 23:39:24 +0100 Subject: [PATCH] make emitMove of pointer.commit a required property to prevent overlap with the optional computeActivePointer from combined pointer --- packages/pointer-events/src/combine.ts | 8 ++++---- packages/pointer-events/src/pointer.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/pointer-events/src/combine.ts b/packages/pointer-events/src/combine.ts index 610c987..4d5f42b 100644 --- a/packages/pointer-events/src/combine.ts +++ b/packages/pointer-events/src/combine.ts @@ -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 } @@ -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) } } @@ -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 { diff --git a/packages/pointer-events/src/pointer.ts b/packages/pointer-events/src/pointer.ts index b21e475..824e313 100644 --- a/packages/pointer-events/src/pointer.ts +++ b/packages/pointer-events/src/pointer.ts @@ -175,7 +175,7 @@ export class Pointer { } this.enabled = enabled if (commit) { - this.commit(nativeEvent) + this.commit(nativeEvent, false) } } @@ -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 @@ -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) } /** @@ -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