API reference / @zaes/tactical-graphics/maplibre / MapLibreInteractions
Class: MapLibreInteractions
Defined in: components/maplibre/interaction/MapLibreInteractions.ts:406
Draw, modify and the four handle gestures.
Exported because a renderer without them is a picture, not an editor — and this was reachable only from inside the demo, so nobody installing the package could build one. NativeLayerRenderer draws; this turns pointer events into edits.
Constructors
Constructor
new MapLibreInteractions(
map,
renderer,
callbacks?
): MapLibreInteractions;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:484
Parameters
map
Map$1
renderer
callbacks?
InteractionCallbacks = {}
Returns
MapLibreInteractions
Accessors
isDrawing
Get Signature
get isDrawing(): boolean;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:733
Returns
boolean
Methods
beginGesture()
beginGesture(kind, event): boolean;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:566
Runs one gesture from a host's affordance, outside the map's own pointer handlers.
The affordance is a DOM element over the map, so its pointerdown never reaches MapLibre — and even if it did, the pointer is nowhere near the graphic, so the hit test would find nothing. The drag is therefore driven from window, and the state onPointerDown would have latched is set here from the selection instead of from a hit test.
Everything after that is the existing machinery: activeGesture makes effectiveMode answer for the gesture, and each move goes through the same applyGesture a handle drag uses.
Parameters
kind
event
PointerEvent
Returns
boolean
See
TacticalGraphicsManager.beginGesture, the OpenLayers twin — the two must stay the same gesture.
cancelDraw()
cancelDraw(): void;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:686
Returns
void
destroy()
destroy(): void;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:502
Returns
void
getMode()
getMode(): EditMode;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:548
Returns
EditMode
selectionBox()
selectionBox(): SelectionBox | undefined;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:628
The selected graphic's on-screen extent, in map-container pixels.
From the rendered geometry's projected bounds, which is the same box the OpenLayers side measures from its rendered features — the two engines have to draw the host's chrome in the same place.
Returns
SelectionBox | undefined
See
boundsOf
setMode()
setMode(mode): void;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:519
Parameters
mode
EditMode
Returns
void
startDraw()
startDraw(name): void;Defined in: components/maplibre/interaction/MapLibreInteractions.ts:671
Arms the draw tool.
A point graphic finishes on the first click and never enters the sketch, so baseGeometryFor is consulted up front rather than at the end — a draw tool that asked afterwards would need a click to discover it did not need one.
Parameters
name
Returns
void