Adding Multiple Context Menu Entries
  • 21 Dec 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Adding Multiple Context Menu Entries

  • Dark
    Light
  • PDF

Article summary

To include multiple entries, return an array of ContextMenuEntry objects and, if using TypeScript, set the return type to ContextMenuEntryInterface[] by running:

// SampleContextMenuEntryLayer.ts
// ...
  public onContextMenu(pos: MouseEventCoordinatesInterface): ContextMenuEntryInterface[]
  {
    //return the ContextMenuEntryInterface
    return [{
      name: "Go to Navvis",
      icon: "fa-globe",
      callback: () =>
      {
        window.open("https://www.navvis.com")
      }
    },
    {
      name: "Go to NavVis Developer Forum",
      icon: "fa-quote-left",
      callback: () =>
      {
        window.open("https://support.navvis.com/forums/")
      }
    }]
  }
// ...


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.