Abstract base class for BIM canvas, providing core functionalities and event handling.

Hierarchy

Constructors

Accessors

  • get canvasElement(): HTMLCanvasElement
  • Gets the canvas element.

    Returns HTMLCanvasElement

  • get canvasHeight(): number
  • Gets the height of the canvas element.

    Returns number

  • get canvasWidth(): number
  • Gets the width of the canvas element.

    Returns number

  • get containerElement(): HTMLDivElement
  • Gets the container div element (supplied in initialization time).

    Returns HTMLDivElement

  • set customCursor(cursorURL: string): void
  • Sets a custom cursor for the canvas.

    Parameters

    • cursorURL: string

      The URL of the custom cursor image.

    Returns void

  • get glContext(): WebGL2RenderingContext
  • Gets the WebGL context.

    Returns

    The WebGL context.

    Returns WebGL2RenderingContext

  • get gpuInfo(): GPUInfo
  • Gets the GPU information.

    Returns

    The GPU information.

    Returns GPUInfo

  • get markups(): Markups
  • Gets the markups instance.

    Returns Markups

  • get markupsElement(): HTMLDivElement
  • Gets the markups div element.

    Returns HTMLDivElement

  • get onCanvasRecreate(): ISignal
  • Gets the canvas recreate event dispatcher.

    Returns ISignal

  • get overlay(): BimCTOverlay
  • Gets the overlay instance.

    Returns BimCTOverlay

  • get pins(): Pins
  • Gets the pins instance.

    Returns Pins

  • get renderer(): BaseRenderer
  • Gets the renderer.

    Returns BaseRenderer

  • set renderer(renderer: BaseRenderer): void
  • Sets the renderer.

    Parameters

    Returns void

  • get rendererElement(): HTMLDivElement
  • Gets the viewer div element.

    Returns HTMLDivElement

  • get viewerElement(): HTMLDivElement
  • Gets the viewer div element.

    Returns HTMLDivElement

  • get wrapperBounds(): DOMRect
  • Gets the bounding rectangle of the wrapper element.

    Returns DOMRect

  • get wrapperHeight(): number
  • Gets the height of the wrapper element. WARN: Not accurate on zooming windows.

    Returns number

  • get wrapperWidth(): number
  • Gets the width of the wrapper element.

    Returns number

  • get xrRefSpace(): XRReferenceSpace | XRBoundedReferenceSpace
  • Gets the XR reference space.

    Returns

    The XR reference space.

    Returns XRReferenceSpace | XRBoundedReferenceSpace

  • get xrSession(): XRSession
  • Gets the XR session.

    Returns

    The XR session.

    Returns XRSession

  • get xrWebLayer(): XRWebGLLayer
  • Gets the XR web layer.

    Returns

    The XR web layer.

    Returns XRWebGLLayer

Methods

  • Creates an XR session.

    Returns

    A promise that resolves to a boolean indicating success.

    Parameters

    Returns Promise<boolean>

  • Crops a snapshot of the canvas at a specific location with given dimensions. If drawOverlays is true, it includes html overlays in the output.

    Returns

    A promise that resolves to a URI containing the cropped image.

    Parameters

    • x: number

      The x-coordinate of the top-left corner of the crop area.

    • y: number

      The y-coordinate of the top-left corner of the crop area.

    • width: number

      The width of the crop area.

    • height: number

      The height of the crop area.

    • drawOverlays: boolean = false

      Whether to include overlays in the snapshot.

    • Optional transparentBackgroundColor: RGB

    Returns Promise<string>

  • Destroys the canvas and performs cleanup.

    Returns Promise<void>

  • Destroys the XR session.

    Parameters

    • endSession: boolean = true

      Whether to end the session.

    Returns Promise<void>

  • Pushes the renderer image to the canvas.

    Returns

    A promise that resolves when the operation is complete.

    Returns Promise<void>

  • Resizes the canvas.

    Returns Promise<void>

  • Sets the close event callback.

    Parameters

    • owner: any

      The owner of the callback.

    • Optional closeEventCallback: ((event: BimEvent) => void)

      The callback function.

        • (event: BimEvent): void
        • Parameters

          • event: BimEvent

          Returns void

    Returns void

  • Sets the external mouse move callback.

    Parameters

    • owner: any

      The owner of the callback.

    • externalMouseMoveCallback: ((event: MouseEvent) => Promise<void>)

      The callback function.

        • (event: MouseEvent): Promise<void>
        • Parameters

          • event: MouseEvent

          Returns Promise<void>

    Returns void

  • Sets the external mouse up callback.

    Parameters

    • owner: any

      The owner of the callback.

    • externalMouseUpCallback: ((event: MouseEvent) => void)

      The callback function.

        • (event: MouseEvent): void
        • Parameters

          • event: MouseEvent

          Returns void

    Returns void

  • Sets the visibility of the game legend.

    Parameters

    • visible: boolean

      Whether the game legend should be visible.

    Returns void

  • Sets the resize event callback.

    Parameters

    • owner: any

      The owner of the callback.

    • Optional resizeEventCallback: ((event: ResizeBimEvent) => void)

      The callback function.

        • (event: ResizeBimEvent): void
        • Parameters

          • event: ResizeBimEvent

          Returns void

    Returns void

  • Sets the visibility of the splash screen.

    Parameters

    • visible: boolean

      Whether the splash screen should be visible.

    • Optional gifImagePath: string

      The path to the GIF image for the splash screen.

    Returns void

  • Controls the visibility of the close button and optionally sets a callback for the button's click event.

    Parameters

    • show: boolean

      A boolean indicating whether to show or hide the close button.

    • Optional closeButtonCallback: (() => void)

      An optional callback function to be executed when the close button is clicked.

        • (): void
        • Returns void

    • Optional buttonTextI18n: string

      An optional text to be displayed on the close button.

    Returns void

  • Parameters

    • text: string
    • type: "error" | "info" | "question" | "warning"
    • Optional closeCallback: ((result?: "yes" | "no") => void)
        • (result?: "yes" | "no"): void
        • Parameters

          • Optional result: "yes" | "no"

          Returns void

    Returns void

  • Takes a snapshot image and maintains aspect ratio.

    Returns

    A URI that contains the image to download or use.

    Parameters

    • Optional requestedWidth: number

      The requested width of the snapshot.

    • Optional requestedHeight: number

      The requested height of the snapshot.

    Returns Promise<string>

  • Takes a snapshot of the top view of the canvas.

    Parameters

    • Optional bBox: BoundingBox3D

      The bounding box to capture.

    • Optional transparentBackgroundColor: boolean

    Returns Promise<{ base64: string; height: number; width: number }>

  • Updates the close button with the given parameters.

    Parameters

    • disabled: boolean
    • Optional buttonTextI18n: string

    Returns void