Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebViewer

Hierarchy

  • WebViewer

Index

Constructors

constructor

  • Creates a new instance of the PictofitWebViewer and renders to the given HTML5 canvas element.

    Parameters

    • canvasId: string

      The ID of the canvas element which acts as render target.

    • Default value resourceProvider: IResourceProvider = new BaseURLResourceProvider()

      Instance of a concrete resource provider. If none is passed, a default BaseURLResourceProvider pointing to "./" is used.

    Returns WebViewer

Properties

onLoadingFinished

onLoadingFinished: function

Event calllback which is triggered when the loading of a configuration has finished.

Type declaration

    • (): void
    • Returns void

onLoadingStarted

onLoadingStarted: function

Event calllback which is triggered when the loading of a configuration has started.

Type declaration

    • (): void
    • Returns void

Accessors

autoSwitchInterval

  • get autoSwitchInterval(): number
  • set autoSwitchInterval(v: number): void
  • Gets/sets the interval for automatically switch from one configuration to the next in seconds. This only has an effect if multiple configurations have been loaded and autoSwitchingActive is set to true.

    Returns number

  • Gets/sets the interval for automatically switch from one configuration to the next in seconds. This only has an effect if multiple configurations have been loaded and autoSwitchingActive is set to true.

    Parameters

    • v: number

    Returns void

autoSwitchingActive

  • get autoSwitchingActive(): boolean
  • set autoSwitchingActive(v: boolean): void
  • Enables/disables auto switching between products (if multiple were defined in the configuration)

    Returns boolean

  • Enables/disables auto switching between products (if multiple were defined in the configuration)

    Parameters

    • v: boolean

    Returns void

autoSwitchingCascadeIndex

  • get autoSwitchingCascadeIndex(): number
  • set autoSwitchingCascadeIndex(value: number): void
  • Gets/sets the index of the configuration cascade that is goining to be switched automatically.

    Returns number

  • Gets/sets the index of the configuration cascade that is goining to be switched automatically.

    Parameters

    • value: number

    Returns void

backgroundColor

  • get backgroundColor(): Color4
  • set backgroundColor(v: Color4): void
  • Sets/returns the background color of the canvas.

    Returns Color4

  • Sets/returns the background color of the canvas.

    Parameters

    • v: Color4

    Returns void

engine

  • get engine(): Engine
  • Returns the underlying BABYLON.Engine instance.

    Returns Engine

resourceProvider

  • Gets/sets the resource provider used for resolving asset urls.

    Returns IResourceProvider

  • Gets/sets the resource provider used for resolving asset urls.

    Parameters

    Returns void

scene

  • get scene(): Scene
  • set scene(newScene: Scene): void
  • Returns the currently used BABYLON.Scene object. Please be aware that this object changes if a new scene is loaded. Also make sure that you don't modify this object while loading is in progress.

    Returns Scene

  • Returns the currently used BABYLON.Scene object. Please be aware that this object changes if a new scene is loaded. Also make sure that you don't modify this object while loading is in progress.

    Parameters

    • newScene: Scene

    Returns void

sceneStackSize

  • get sceneStackSize(): number
  • Returns the number of elements on the configuration stack (number of cascades).

    Returns number

userInteractionEnabled

  • get userInteractionEnabled(): boolean
  • set userInteractionEnabled(v: boolean): void
  • Enables/disables whether the user can control the camera.

    Returns boolean

  • Enables/disables whether the user can control the camera.

    Parameters

    • v: boolean

    Returns void

Methods

loadConfig

  • loadConfig(input: string | object | Array<string> | Array<object>, cascade?: boolean, identifier?: string): Promise<void>
  • Loads the json based configuration file from the given url or from an object.Be aware that the loading is performed asynchronous. This means that settings you've changed before might get overwritten. To make sure this doesn't happen, apply your changes in the onLoadingStarted event.

    Parameters

    • input: string | object | Array<string> | Array<object>

      Url to a .json configuration file, an array of urls, configuration object or and array of configuration objects. Using arrays enables the switching between configurations either through the auto-swichting functionality or by manually triggering nextConfiguration/previousConfiguration.

    • Default value cascade: boolean = false

      If set to yes, this configuration is applied on top (a cascade level is added) of the existing ones. Otherwise, the loaded configurations replaces everything.

    • Optional identifier: string

      A identifier that is passed to the use IResourceProvider for resolving the asset requests

    Returns Promise<void>

    A promise which can be used to chain loading events.

loadConfigFromObject

  • loadConfigFromObject(input: object | Array<object>, cascade: boolean, identifier?: string): Promise<void>
  • Loads the configuration from the provided json object.

    deprecated

    Use loadConfig in the future

    Parameters

    • input: object | Array<object>
    • cascade: boolean
    • Optional identifier: string

    Returns Promise<void>

loadConfigFromURL

  • loadConfigFromURL(input: string | Array<string>, cascade?: boolean, identifier?: string): Promise<void>
  • Loads the .json based configuration file from the given url. Be aware that the loading is performed asynchronous. This means that settings you've changed before might get overwritten. To make sure this doesn't happen, apply your changes in the onLoadingStarted event.

    Parameters

    • input: string | Array<string>
    • Default value cascade: boolean = false
    • Optional identifier: string

    Returns Promise<void>

nextConfiguration

  • nextConfiguration(cascadeIndex?: number): Promise<void>
  • Switch to next configuration in the list. Cycles between last and first configuration if the end has been reached.

    Parameters

    • Default value cascadeIndex: number = 0

    Returns Promise<void>

previousConfiguration

  • previousConfiguration(cascadeIndex?: number): Promise<void>
  • Switch to previous configuration in config list. Cycles between first and last configuration if the beginnig has been reached.

    Parameters

    • Default value cascadeIndex: number = 0

    Returns Promise<void>

replaceConfigurationAtIndex

  • replaceConfigurationAtIndex(input: string | object | Array<string> | Array<object>, cascadeIndex: number, identifier?: string): Promise<void>
  • Replaces a configuration at a certain cascade level. This is an alternative to loading a array of configurations and then switching using the previousConfiguration/nextConfiguration methods. Instead, you can use this method to directly replace them at a certain cascade level.

    Parameters

    • input: string | object | Array<string> | Array<object>

      Url to a .json configuration file, an array of urls, configuration object or and array of configuration objects. Using arrays enables the switching between configurations either through the auto-swichting functionality or by manually triggering nextConfiguration/previousConfiguration.

    • cascadeIndex: number

      Index of the configuration which should be replaced in the stack

    • Optional identifier: string

      A identifier that is passed to the use IResourceProvider for resolving the asset requests

    Returns Promise<void>

resize

  • resize(): void
  • Triggers the resize event which will re-render the scene with the new canvas dimensions to keep the right proportions.

    Returns void

setConfigurationIndex

  • setConfigurationIndex(index: number, cascadeIndex?: number): Promise<void>
  • Switches to the configuration with the provided index and cascade level.

    Parameters

    • index: number

      Index of the target configuration

    • Default value cascadeIndex: number = 0

    Returns Promise<void>

unloadAllConfigs

  • unloadAllConfigs(): void
  • Unloads all configs that are currently on the stack.

    Returns void

unloadConfig

  • unloadConfig(count?: number): void
  • Unloads the count topmost configs on the stack.

    Parameters

    • Default value count: number = 1

      Number of configurations to unload

    Returns void

Generated using TypeDoc