-
Name Type Description optionsOptions.
Name Type Description idstring | undefined Id option
mapmodule:cercaliagl/Map~Map | undefined Map
fixedPositionmodule:maplibre-gl~LngLat | undefined Fixed position in map
classNamestring Context menu class name
Methods
-
Add a new option in the context menu at the end or in a specific position. Returns options identifier. If the id options exist removes previous option.
Name Type Description idstring Option's identifier.
namestring Text will be displayed in option.
callbackFnfunction Function will be fired when users click the option.
positionnumber The position where option will be added.
classNamestring Classname for option.
-
Add submenu. A submenu contains one or more options
Name Type Description idstring Specify internal Id element
namestring Label of submenu.
optionListArray.<module:cercaliagl/ContextMenu~ContextMenuSubmenuOption> Option list. Example:
{[{id:'btn1', label:'Button1', callback: 'callbackFn1'}, {id:'btn2', label:'Button2', callback: 'callbackFn1'}]}. -
Close the menu.
-
closeSubmenu(id)
-
Close Submenu
Name Type Description idstring Id.
-
Returns
trueif the option exists.Name Type Description idstring Option's identifier.
Returns:
True if exists.
-
Hide menu option.
Name Type Description idstring Id.
-
Returns
trueif the context menu is visible.Returns:
Returnstrueif is visible.
-
Open the menu. If menu isn't position fixed needs a position to be displayed.
Name Type Description lonLatmodule:maplibre-gl~LngLat | module:cercaliagl/LonLat~LonLat If menu isn't position fixed, menu will be displayed in ths position.
-
openSubmenu(id)
-
Open Submenu
Name Type Description idstring Id.
-
Remove all options in context menu.
-
Remove an option from the context menu.
Name Type Description idstring Option's identifier.
-
Show menu option.
Name Type Description idstring Id.