Options
All
  • Public
  • Public/Protected
  • All
Menu

The 3D Viewer at the heart of the xeokit SDK.

Hierarchy

  • Viewer

Index

Constructors

Properties

camera: Camera

The Viewer's Camera. This is also found on Scene.camera.

property

camera

cameraControl: CameraControl

The Viewer's CameraControl, which controls the Scene's Camera with mouse, touch and keyboard input.

property

cameraControl

cameraFlight: CameraFlightAnimation

The Viewer's CameraFlightAnimation, which is used to fly the Scene's Camera to given targets.

property

cameraFlight

id: string | number

The Viewer's ID.

property

id

localeService: LocaleService

The viewer's locale service.

This is configured via the Viewer's constructor.

By default, this service will be an instance of LocaleService, which will just return null translations for all given strings and phrases.

property

localeService

since

2.0

metaScene: MetaScene

Metadata about the Scene and the models and objects within it.

property

metaScene

readonly
scene: Scene

The Viewer's Scene.

property

scene

Methods

  • beginSnapshot(): void
  • destroy(): void
  • endSnapshot(): void
  • Exits snapshot mode.

    Switches rendering back to the main canvas.

    Returns void

  • error(msg: string): void
  • Logs an error message to the JavaScript developer console, prefixed with the ID of this Viewer.

    Parameters

    • msg: string

      The error message

    Returns void

  • fire(event: string, value: any): void
  • Fires an event at this Viewer.

    Parameters

    • event: string

      Event name

    • value: any

      Event parameters

    Returns void

  • getSnapshot(params: { format?: "png" | "jpeg" | "bmp"; height?: number; includeGizmos?: boolean; width?: number }): string
  • Gets a snapshot of this Viewer's Scene as a Base64-encoded image.

    Usage:

    const imageData = viewer.getSnapshot({
    width: 500,
    height: 500,
    format: "png"
    });

    Parameters

    • params: { format?: "png" | "jpeg" | "bmp"; height?: number; includeGizmos?: boolean; width?: number }
      • Optional format?: "png" | "jpeg" | "bmp"
      • Optional height?: number
      • Optional includeGizmos?: boolean
      • Optional width?: number

    Returns string

    String-encoded image data URI.

  • log(msg: string): void
  • Logs a message to the JavaScript developer console, prefixed with the ID of this Viewer.

    Parameters

    • msg: string

      The message

    Returns void

  • on(event: string, callback: Function): void
  • Subscribes to an event fired at this Viewer.

    Parameters

    • event: string

      The event

    • callback: Function

      Callback fired on the event

    Returns void

Generated using TypeDoc