UNPKG

@solid-primitives/pointer

Version:

A collection of primitives, giving you a nicer API to handle pointer events in a reactive context.

28 lines (27 loc) 1.14 kB
import { Position } from "@solid-primitives/utils"; import { AnyOnEventName, ParsedEventHandlers, PointerState, PointerStateWithActive } from "./types.js"; /** * A non-reactive helper function. It turns a position relative to the screen/window, to be relative to an element. * @param poz object containing `x` & `y` * @param el element to calculate the position of * @returns the `poz` with `x` and `y` changed, and `isInside` added */ export declare const getPositionToElement: <T extends Position>(poz: T, el: Element) => T & { isInside: boolean; }; export declare const parseHandlersMap: <H extends Record<AnyOnEventName, any>>(handlers: H) => ParsedEventHandlers<H>; export declare const toState: (e: PointerEvent) => PointerState; export declare const toStateActive: (e: PointerEvent, isActive: boolean) => { isActive: boolean; pressure: number; pointerId: number; tiltX: number; tiltY: number; width: number; height: number; twist: number; pointerType: import("./types.js").PointerType | null; x: number; y: number; }; export declare const DEFAULT_STATE: PointerStateWithActive;