Skip to content

Commit ac4cd7b

Browse files
authored
Merge branch 'pmndrs:main' into fix/xrlayer-uikit-world-matrix
2 parents e9f756a + aa7b97f commit ac4cd7b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/handles/handle-component.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ In situations where the handle target is placed inside a constantly changing gro
6262
**multitouch**
6363
By default, handles can be interacted with using multiple input devices. By setting `multitouch` to `false`, only the first input device will be used.
6464

65+
**filter**
66+
Allows to filter interactions based on the event. Return `false` to ignore the event.
67+
6568
**stopPropagation**
6669
By default, events that occur on handles are not propagated upwards and therefore do not reach their ancestors. Setting `stopPropagation` to `false` will re-enable event propagation for events that occur on the handle.
6770

packages/handle/src/store.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export type HandleOptions<T> = {
5555
*/
5656
uniform?: boolean
5757
}
58-
//TODO: filter
58+
/**
59+
* Filter interaction. Return false to ignore the event.
60+
*/
61+
filter?: (event: PointerEvent) => boolean
5962
/**
6063
* @default true
6164
*/
@@ -160,6 +163,9 @@ export class HandleStore<T>
160163
}
161164

162165
private onPointerDown(event: PointerEvent): void {
166+
if (this.getOptions().filter?.(event) === false) {
167+
return
168+
}
163169
this.stopPropagation(event)
164170
if (!this.capturePointer(event.pointerId, event.object)) {
165171
return

0 commit comments

Comments
 (0)