@smartmaps/smartmaps-gl / ContextMenu
Class: ContextMenu
Smartmaps ContextMenu An ContextMenu that offers the user an additional way to interact with the map.
Remarks
- can be activated/disabled with the contextmenu option MapOptions
Examples
```ts contextmenu: true
@example ```ts contextmenu: { contextmenuItems: [ { action: 'centerMap', label: 'Center map here', handler: (coords, map) => map.setCenter(coords) }, { action: 'addMarker', label: 'Add Marker', handler: (coords, map) => new Marker().setLngLat(coords).addTo(map) }] }
``ts
map.addControl( new ContextMenu({
contextmenuItems: [ {
action: 'zoomIn',
label:
\({icons.zoomIn} Zoom in,
handler: (_, map: Map) => map.zoomIn()
},
{
action: 'zoomOut',
label:
\) Zoom out`,
handler: (_, map: Map) => map.zoomOut()
}],
}));
@public
Constructors
new ContextMenu()
new ContextMenu(
map
,options
?):ContextMenu
Parameters
map
options?
the control's options
Returns
Methods
addItem()
addItem(
options
):void
Parameters
options
Returns
void
hide()
hide():
void
Returns
void
removeAllItems()
removeAllItems():
void
Returns
void
removeItem()
removeItem(
action
):void
Parameters
action
string
Returns
void