Interface Handler
interface Handler {
contextmenu?: (e: MouseEvent) => void | HandlerResult;
dblclick?: (e: MouseEvent, point: Point) => void | HandlerResult;
keydown?: (e: KeyboardEvent) => void | HandlerResult;
keyup?: (e: KeyboardEvent) => void | HandlerResult;
mousedown?: (e: MouseEvent, point: Point) => void | HandlerResult;
mousemove?: (e: MouseEvent, point: Point) => void | HandlerResult;
mousemoveWindow?: (e: MouseEvent, point: Point) => void | HandlerResult;
mouseup?: (e: MouseEvent, point: Point) => void | HandlerResult;
mouseupWindow?: (e: MouseEvent, point: Point) => void | HandlerResult;
renderFrame?: () => void | HandlerResult;
touchcancel?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchend?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchmove?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchmoveWindow?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchstart?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
wheel?: (e: WheelEvent, point: Point) => void | HandlerResult;
disable(): void;
enable(): void;
isActive(): boolean;
isEnabled(): boolean;
reset(): void;
}
contextmenu?: (e: MouseEvent) => void | HandlerResult;
dblclick?: (e: MouseEvent, point: Point) => void | HandlerResult;
keydown?: (e: KeyboardEvent) => void | HandlerResult;
keyup?: (e: KeyboardEvent) => void | HandlerResult;
mousedown?: (e: MouseEvent, point: Point) => void | HandlerResult;
mousemove?: (e: MouseEvent, point: Point) => void | HandlerResult;
mousemoveWindow?: (e: MouseEvent, point: Point) => void | HandlerResult;
mouseup?: (e: MouseEvent, point: Point) => void | HandlerResult;
mouseupWindow?: (e: MouseEvent, point: Point) => void | HandlerResult;
renderFrame?: () => void | HandlerResult;
touchcancel?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchend?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchmove?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchmoveWindow?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
touchstart?: (
e: TouchEvent,
points: Point[],
mapTouches: Touch[],
) => void | HandlerResult;
wheel?: (e: WheelEvent, point: Point) => void | HandlerResult;
disable(): void;
enable(): void;
isActive(): boolean;
isEnabled(): boolean;
reset(): void;
}
Hierarchy (View Summary)
Implemented by
Properties
Optional Readonlycontextmenu
Optional Readonlydblclick
Optional Readonlykeydown
Optional Readonlykeyup
Optional Readonlymousedown
Optional Readonlymousemove
Optional ReadonlymousemoveWindow
Optional Readonlymouseup
Optional ReadonlymouseupWindow
Optional ReadonlyrenderFrame
renderFrame is the only non-dom event. It is called during render
frames and can be used to smooth camera changes (see scroll handler).
Optional Readonlytouchcancel
Optional Readonlytouchend
Optional Readonlytouchmove
Optional ReadonlytouchmoveWindow
Optional Readonlytouchstart
Optional Readonlywheel
Methods
disable
Returns void
enable
Returns void
isActive
This is used to indicate if the handler is currently active or not. In case a handler is active, it will block other handlers from getting the relevant events. There is an allow list of handlers that can be active at the same time, which is configured when adding a handler.
Returns boolean
isEnabled
Returns boolean
reset
resetcan be called by the manager at any time and must reset everything to it's original stateReturns void
Was this helpful?
Handlers interpret dom events and return camera changes that should be applied to the map (
HandlerResults). The camera changes are all deltas. The handler itself should have no knowledge of the map's current state. This makes it easier to merge multiple results and keeps handlers simpler. For example, if there is a mousedown and mousemove, the mousePan handler would return apanDeltaon the mousemove.