-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointerTracker.d.ts
More file actions
36 lines (31 loc) · 1.23 KB
/
Copy pathPointerTracker.d.ts
File metadata and controls
36 lines (31 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* lite-pointer-tracker — Lightweight Pointer Events Manager
*/
export interface PointerTrackerHandlers {
/** Called on primary button pointerdown. Receives the raw PointerEvent. */
onStart?: (event: PointerEvent) => void;
/** Called on pointermove while active. Receives the raw PointerEvent. */
onMove?: (event: PointerEvent) => void;
/** Called on pointerup, pointercancel, lostpointercapture, or ghost-drag detection. */
onEnd?: (event: PointerEvent) => void;
}
export class PointerTracker {
/** Whether a pointer interaction is currently in progress. */
isActive: boolean;
/**
* Create a pointer tracker on the given element.
*
* Sets `touch-action: none` on the target to prevent browser gesture
* hijacking. The original value is restored on `destroy()`.
*
* @param target The DOM element to track pointer events on.
* @param handlers Callback functions for start, move, and end events.
*/
constructor(target: HTMLElement, handlers?: PointerTrackerHandlers);
/**
* Stop tracking, remove all event listeners, restore `touch-action`,
* and release the target reference. Idempotent.
*/
destroy(): void;
}
export default PointerTracker;