Skip to main content

UseLongPress

The pointer handlers to spread on the host, plus hooks for the map engine.

This is an interface exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import type { UseLongPress } from "@mapcairn/map";

interface UseLongPress

Properties​

cancel​

readonly cancel: () => void;

Cancels a pending press. Call it when the map moves.

consumeClick​

readonly consumeClick: () => boolean;

Returns true, once, for the engine click that follows a long-press, so the caller can drop it. A new press clears the flag, so a missing engine click never swallows a later one.

handlers​

readonly handlers: {
readonly onPointerDown: (event: PointerEvent_2) => void;
readonly onPointerMove: (event: PointerEvent_2) => void;
readonly onPointerUp: (event: PointerEvent_2) => void;
readonly onPointerCancel: (event: PointerEvent_2) => void;
readonly onContextMenu: (event: MouseEvent_2) => void;
};

The pointer and context-menu handlers to spread on the map host element.

Source: packages/map/src/host/useLongPress.ts:39