Adding a Single Context Menu Entry
- 21 Dec 2023
- 1 Minute to read
- Print
- DarkLight
- PDF
Adding a Single Context Menu Entry
- Updated on 21 Dec 2023
- 1 Minute to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
To include one context menu entry, the override method should return a ContextMenuEntry object. The properties for a valid ContextMenuEntry
are:
name | The text that appears in the menu |
icon | An icon ligature name that appears next to the name |
callback | The function that is triggered when a user clicks or presses the entry |
Run the following to add a single context menu entry:
// SampleContextMenuEntryLayer.ts
import {
ContextMenuEntryInterface, CustomLayer,
MouseEventCoordinatesInterface
} from "@navvis/ivion";
export class SampleContextMenuEntryLayer extends CustomLayer
{
public onContextMenu(pos: MouseEventCoordinatesInterface): ContextMenuEntryInterface
{
//return the ContextMenuEntryInterface
return {
name: "Go to Navvis",
icon: "fa-globe",
callback: () =>
{
window.open("https://www.navvis.com")
}
}
}
}
Was this article helpful?