-
Name Type Description options
Options.
Name Type Description id
string | undefined Id option
map
module:cercaliagl/Map~Map | undefined Map
fixedPosition
module:cercaliagl/LonLat~LonLat | undefined Fixed position in map
className
string 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 id
string Option's identifier.
name
string Text will be displayed in option.
callback
function Function will be fired when users click the option.
position
number The position where option will be added.
className
string Classname for option.
-
Add submenu. A submenu contains one or more options
Name Type Description id
string Specify internal Id element
name
string Label of submenu.
optionList
Array.<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 id
string Id.
-
Returns
true
if the option exists.Name Type Description id
string Option's identifier.
Returns:
True if exists.
-
Hide menu option.
Name Type Description id
string Id.
-
Returns
true
if the context menu is visible.Returns:
Returnstrue
if is visible.
-
Open the menu. If menu isn't position fixed needs a position to be displayed.
Name Type Description lonLat
module: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 id
string Id.
-
Remove all options in context menu.
-
Remove an option from the context menu.
Name Type Description id
string Option's identifier.
-
Show menu option.
Name Type Description id
string Id.