Base class used to create context menus
The constructor
Name | Type | Description |
---|---|---|
contextMenuEvent | Event | The event that have triggered the menu |
parentNode | null or HTMLElement | The parent node of the menu. Can be null for leaflet objects |
The cancel button HTMLElement
The X screen coordinate of the mouse event that have triggered the menu
The Y screen coordinate of the mouse event that have triggered the menu
The root HTMLElement of the menu
A flag indicating when the menu must have a parent node. Menus triggered from leaflet objects don't have parentNode
A flag indicating if a menu is active
The lat an lng at the mouse position for events triggered by the map
The HTMLElement of the menu items
The list of menu items to use. Must be implemented in the derived classes
The ObjId of the TravelObject on witch the mouse is positionned if any
OnOk method used by the menu operator. Clean the variables and call the Promise Ok handler
Name | Type | Description |
---|---|---|
selectedItemObjId | Number | The id of the item selected by the user |
Show the menu on the screen and perform the correct operation when an item is selected
The cancel button HTMLElement
The X screen coordinate of the mouse event that have triggered the menu
The Y screen coordinate of the mouse event that have triggered the menu
The root HTMLElement of the menu
The active BaseContextMenu instance. Needed to close the menu when a second menu is loaded
A flag indicating when the menu must have a parent node. Menus triggered from leaflet objects don't have parentNode
The HTMLElement of the menu items
The associated BaseContextMenuOperator object
The promise error handler
The promise ok handler
The ObjId of the TravelObject on witch the mouse is positionned if any
The min margin between the screen borders and the menu in pixels
Create the cancel button and it's event listener to the menu
Build the menu container and add event listeners
Create and show the menu. This method is called by the Promise
Name | Type | Description |
---|---|---|
onPromiseOk | Function | The Promise Ok handler |
onPromiseError | Function |
Create the menuItems html elements
Move the container, so the top of the container is near the mouse