import { CompassCorners } from './interfaces'; import { CanvasPointerEvent } from './types/events'; /** * Allows click and drag actions to be declared ahead of time during a pointerdown event. * * By default, it retains the most recent event of each type until it is reset (on pointerup). * - {@link eDown} * - {@link eMove} * - {@link eUp} * * Depending on whether the user clicks or drags the pointer, only the appropriate callbacks are called: * - {@link onClick} * - {@link onDoubleClick} * - {@link onDragStart} * - {@link onDrag} * - {@link onDragEnd} * - {@link finally} * @see * - {@link LGraphCanvas.processMouseDown} * - {@link LGraphCanvas.processMouseMove} * - {@link LGraphCanvas.processMouseUp} */ export declare class CanvasPointer { #private; /** Maximum time in milliseconds to ignore click drift */ static bufferTime: number; /** Maximum gap between pointerup and pointerdown events to be considered as a double click */ static doubleClickTime: number; /** Maximum offset from click location */ static get maxClickDrift(): number; static set maxClickDrift(value: number); /** The element this PointerState should capture input against when dragging. */ element: Element; /** Pointer ID used by drag capture. */ pointerId?: number; /** Set to true when if the pointer moves far enough after a down event, before the corresponding up event is fired. */ dragStarted: boolean; /** The {@link eUp} from the last successful click */ eLastDown?: CanvasPointerEvent; /** Used downstream for touch event support. */ isDouble: boolean; /** Used downstream for touch event support. */ isDown: boolean; /** The resize handle currently being hovered or dragged */ resizeDirection?: CompassCorners; /** * If `true`, {@link eDown}, {@link eMove}, and {@link eUp} will be set to * `undefined` when {@link reset} is called. * * Default: `true` */ clearEventsOnReset: boolean; /** The last pointerdown event for the primary button */ eDown?: CanvasPointerEvent; /** The last pointermove event for the primary button */ eMove?: CanvasPointerEvent; /** The last pointerup event for the primary button */ eUp?: CanvasPointerEvent; /** * If set, as soon as the mouse moves outside the click drift threshold, this action is run once. * @param pointer [DEPRECATED] This parameter will be removed in a future release. * @param eMove The pointermove event of this ongoing drag action. * * It is possible for no `pointermove` events to occur, but still be far from * the original `pointerdown` event. In this case, {@link eMove} will be null, and * {@link onDragEnd} will be called immediately after {@link onDragStart}. */ onDragStart?(pointer: this, eMove?: CanvasPointerEvent): unknown; /** * Called on pointermove whilst dragging. * @param eMove The pointermove event of this ongoing drag action */ onDrag?(eMove: CanvasPointerEvent): unknown; /** * Called on pointerup after dragging (i.e. not called if clicked). * @param upEvent The pointerup or pointermove event that triggered this callback */ onDragEnd?(upEvent: CanvasPointerEvent): unknown; /** * Callback that will be run once, the next time a pointerup event appears to be a normal click. * @param upEvent The pointerup or pointermove event that triggered this callback */ onClick?(upEvent: CanvasPointerEvent): unknown; /** * Callback that will be run once, the next time a pointerup event appears to be a normal click. * @param upEvent The pointerup or pointermove event that triggered this callback */ onDoubleClick?(upEvent: CanvasPointerEvent): unknown; /** * Run-once callback, called at the end of any click or drag, whether or not it was successful in any way. * * The setter of this callback will call the existing value before replacing it. * Therefore, simply setting this value twice will execute the first callback. */ get finally(): (() => unknown) | undefined; set finally(value: (() => unknown) | undefined); constructor(element: Element); /** * Callback for `pointerdown` events. To be used as the event handler (or called by it). * @param e The `pointerdown` event */ down(e: CanvasPointerEvent): void; /** * Callback for `pointermove` events. To be used as the event handler (or called by it). * @param e The `pointermove` event */ move(e: CanvasPointerEvent): void; /** * Callback for `pointerup` events. To be used as the event handler (or called by it). * @param e The `pointerup` event */ up(e: CanvasPointerEvent): boolean; /** * Resets the state of this {@link CanvasPointer} instance. * * The {@link finally} callback is first executed, then all callbacks and intra-click * state is cleared. */ reset(): void; }