Skip to main content

Creating a Custom Layer

Follow these steps to create a custom layer:
  1. In your project, create a file called SampleContextMenuEntryLayer.ts.
  2. Add a class that extends from the CustomLayer class by running:
    // SampleContextMenuEntryLayer.ts
    import {CustomLayer} from "@navvis/ivion";

    export class SampleContextMenuEntryLayer extends CustomLayer
    {
    }
  3. Override the onContextMenu() method so that the custom layer can provide a context menu entry to the user by running:
    // SampleContextMenuEntryLayer.ts
    import {
    ContextMenuEntryInterface, CustomLayer,
    MouseEventCoordinatesInterface
    } from "@navvis/ivion";

    export class SampleContextMenuEntryLayer extends CustomLayer
    {
    public onContextMenu(pos: MouseEventCoordinatesInterface): ContextMenuEntryInterface
    {
    }