Skip to content

Commit c18b83c

Browse files
committed
feat: support "filter" property for the handles
1 parent 7ef600d commit c18b83c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎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)