Skip to main content

flywave-map-controls.longpresshandler

Home > @flywave/flywave-map-controls > LongPressHandler

LongPressHandler class

Class that can be used to track long presses on an HTML Element. A long press is a press that lasts a minimum duration (see the [[timeout]] member) while the pointer is not moved more than a certain threshold (see the [[moveThreshold]] member).

Signature:

export declare class LongPressHandler 

Constructors

Constructor

Modifiers

Description

(constructor)(element, onLongPress, onTap)

Default constructor.

Properties

Property

Modifiers

Type

Description

buttonId

number

Mouse button id that should be handled by this event.

element

readonly

HTMLElement

moveThreshold

number

If the cursor moves more than the given number of pixels, it is not a long-press, but a pan.

onLongPress

(event: MouseEvent | Touch) => void

onTap?

(event: MouseEvent | Touch) => void

(Optional)

timeout

number

How long to wait (in ms) until a press is considered a long press.

Methods

Method

Modifiers

Description

dispose()

Removes all events listeners. No more events will be sent.