The UnitContextMenu is shown when the user rightclicks on a unit. It dynamically presents the user with possible actions to perform on the unit.

Hierarchy

Constructors

Properties

#container: null | HTMLElement
#latlng: LatLng = ...
#visibleSubMenu: null | string = null
#x: number = 0
#y: number = 0

Methods

  • Set the options that will be presented to the user in the contextmenu

    Parameters

    • options: {
          [key: string]: {
              text: string;
              tooltip: string;
          };
      }

      Dictionary element containing the text and tooltip of the options shown in the menu

      • [key: string]: {
            text: string;
            tooltip: string;
        }
        • text: string
        • tooltip: string
    • callback: CallableFunction

      Callback that will be called when the user clicks on one of the options

    Returns void

  • Show the contextmenu on top of the map, usually at the location where the user has clicked on it.

    Parameters

    • x: number

      X screen coordinate of the top left corner of the context menu

    • y: number

      Y screen coordinate of the top left corner of the context menu

    • latlng: LatLng

      Leaflet latlng object of the mouse click

    Returns void

Generated using TypeDoc