Class CustomLayer

CustomLayer enables API users to create a scene layer in any view. Creating a subclass that extends CustomLayer can leverage the event handlers deliniated in SceneLayerInterface.

Hierarchy

Constructors

Properties

sceneGroup: Object3D<Event>

Container object for all 3D objects of this scene layer

ORTHO_DEBOUNCE: number

Time in ms to debounce map view rendering by to avoid unnecessary work.

Accessors

  • get targetViewport(): ViewportInterface
  • Target viewport

    Returns ViewportInterface

  • set targetViewport(value): void
  • Target viewport

    Parameters

    Returns void

  • get visible(): boolean
  • Layer visibility

    Returns boolean

  • set visible(visible): void
  • Layer visibility

    Parameters

    • visible: boolean

    Returns void

Methods

  • Called after rendering of all viewports

    Parameters

    • camera: Camera

      Camera used to render the view

    Returns void

  • Called before rendering

    Parameters

    • camera: Camera

      Camera used to render the view

    Returns void

  • Called before rendering a viewport. Updates layer visibility depending on viewport and avoids raycasting objects if #targetViewport doesn't match the passed viewport.

    Note: If you override this method and change the position, orientation or scale of a mesh, and you rely on mouse events on the meshes or use getObjectsUnderCursor(), call this.sceneGroup.updateWorldMatrix(false, true); in your overridden method.

    Parameters

    Returns void

  • Called shortly after the camera has stopped moving

    Parameters

    • asyncWork: Promise<void>

      Promise which blocks until the AbstractViewInterface has completed any asynchronous work, independent of whether it rejects or resolves.

    Returns void

  • Called for mouse clicks and taps

    Returns

    Return true to consume the event, false to pass it on

    Parameters

    Returns boolean

  • Called when the view is destroyed. Override this method and clean up all references to objects that would prevent garbage collection, e.g., signal handlers and transient fields that your scene layer may have put on entities.

    This implementation will detach all signal handlers registered by connectToSignal(), remove the sceneGroup from the scene and set it to undefined.

    Override this method to clean up references (and call the super class method)

    Returns void

  • Called when a key is pressed down

    Returns

    Return true to consume the event, false to pass it on to other layers

    Parameters

    • event: KeyboardEvent

      Key event data

    Returns boolean

  • Called when a key is released

    Returns

    Return true to consume the event, false to pass it on to other layers

    Note

    released keys on a physical keyboard connected to an iOS device do not fire the keyup event

    Parameters

    • event: KeyboardEvent

      Key event data

    Returns boolean

  • Called when the mouse wheel is used

    Returns

    Return true to consume the event, false to pass it on

    Parameters

    Returns boolean

  • Called shortly after the camera inside the viewport has stopped moving

    Parameters

    • viewport: ViewportInterface

      The viewport where the camera move happened

    • asyncWork: Promise<void>

      Promise which blocks until the AbstractViewInterface has completed any asynchronous work, independent of whether it rejects or resolves.

    Returns void

  • Wrap the provided Signal into a TrackedSignal which keeps track of calls to its connect method. The connections made through the TrackedSignal will be disconnected automatically when the scene layer is destroyed.

    Returns

    Signal that keeps track of connections made to it.

    Type Parameters

    • CB extends ((...args) => unknown)

    Parameters

    • signal: Signal<CB>

      The signal to wrap.

    Returns TrackedSignal<CB>

Generated using TypeDoc