Skip to main content

useLongPress

Long-press on the map, implemented once with pointer events so it behaves the same on every engine. A press fires after LONG_PRESS_DELAY_MS unless the pointer moves more than 10 CSS pixels, a second pointer joins (pinch), the pointer is released or cancelled, or the map moves (cancel). Right-click fires it at once and suppresses the browser's context menu.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { useLongPress } from "@mapcairn/map";

function useLongPress(options: UseLongPressOptions): UseLongPress;

Parameters​

  • options (UseLongPressOptions)

Returns​

UseLongPress

Remarks​

Android raises contextmenu during a touch long-press as well, so a press fires at most once whichever comes first. Only the primary button starts a timed press.

See also​

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