Viewer
    Preparing search index...

    Variable createViewportConst

    createViewport: (
        properties?: ViewportCreationDefinition,
    ) => Promise<IViewportApi>

    Create and initialize a viewport with the provided type and canvas, and return a viewport api object allowing to control it.

    An optional identifier for the viewport can be provided. This identifier can be used to retrieve the viewport object from viewports. In case no identifier is provided, a unique one will be generated.

    By default a new viewport displays the complete scene tree. Viewports can be excluded from displaying geometry for specific sessions by using the excludeViewports property of ISessionApi.

    Type Declaration

      • (properties?: ViewportCreationDefinition): Promise<IViewportApi>
      • Parameters

        • Optionalproperties: ViewportCreationDefinition
          • Optionalbranding?: {
                backgroundColor?: string;
                busyModeDisplay?: BUSY_MODE_DISPLAY;
                busyModeSpinner?: string;
                logo?: string | null;
                spinnerPositioning?: SPINNER_POSITIONING;
            }

            The branding options of the viewport.

            • OptionalbackgroundColor?: string

              Optional background color to show while the viewport is hidden, can include alpha channel. A default color will be used if none is provided.

            • OptionalbusyModeDisplay?: BUSY_MODE_DISPLAY

              The mode used to indicate that the viewport is busy. (default: BUSY_MODE_DISPLAY.SPINNER) Whenever the busy mode gets toggled, the events EVENTTYPE_VIEWPORT.BUSY_MODE_ON and EVENTTYPE_VIEWPORT.BUSY_MODE_OFF will be emitted.

            • OptionalbusyModeSpinner?: string

              Optional URL to a logo to be displayed while the viewport is in busy mode. A default logo will be used if none is provided. The positioning of the spinner can be influenced via SPINNER_POSITIONING.

            • Optionallogo?: string | null

              Optional URL to a logo to be displayed while the viewport is hidden. A default logo will be used if none is provided. Supply null to display no logo at all.

            • OptionalspinnerPositioning?: SPINNER_POSITIONING

              Where the spinner that is specified by BUSY_MODE_DISPLAY is displayed on the screen. (default: BUSY_MODE_DISPLAY.BOTTOM_RIGHT)

          • Optionalcanvas?: HTMLCanvasElement

            The canvas element in which the viewport should be created, it is encourage to provide one. If none was provided, a canvas will be created.

          • Optionalflags?: { [key: string]: FLAG_TYPE }

            Optional flags that should be initially set on the viewport. The key is the token that is used to identify the flag, and the value is the type of the flag.

          • Optionalid?: string

            The unique identifier of the session that was specified or automatically chosen on creation of the viewport.

          • OptionalinitialAutoAdjust?: boolean

            If the viewport should automatically adjust the camera to fit the model on creation. (default: false)

          • OptionalsessionSettingsId?: string

            The id of the session of which the settings should be used. Only works when sessionSettingsMode is set to SESSION_SETTINGS_MODE.SESSION.

          • OptionalsessionSettingsMode?: SESSION_SETTINGS_MODE

            The mode in which settings should be applied. (default: SESSION_SETTINGS_MODE.FIRST)

          • Optionalvisibility?: VISIBILITY_MODE

            The initial visibility of the viewport. (default: VISIBILITY_MODE.SESSION)

          • OptionalvisibilitySessionIds?: string[]

            The ids of the sessions that should be displayed in the viewport. This only is considered if the visibility is set to VISIBILITY_MODE.SESSIONS. It's recommended that with this workflow, the sessionSettingsMode is set to SESSION_SETTINGS_MODE.SESSION and a sessionSettingsId is provided.

        Returns Promise<IViewportApi>