@squareys/webdecks-sdk - v0.0.0
    Preparing search index...

    Class Viewport

    A live WebGPU view of a document, presenting the engine's render directly to a host <canvas> through the swapchain — never a pixel readback. Create one with EngineModule.createViewport; drive it with Viewport.start. The facade's mutators request a frame after each edit, so an attached viewport repaints on its own.

    Index

    The canvas this viewport presents to.

    • get width(): number

      The current backing width in device pixels.

      Returns number

    • get height(): number

      The current backing height in device pixels.

      Returns number

    • get devicePixelRatio(): number

      Returns number

    • set devicePixelRatio(value: number): void

      Parameters

      • value: number

      Returns void

    • get zoom(): number

      Returns number

    • set zoom(value: number): void

      Parameters

      • value: number

      Returns void

    • Begin presenting. In onDemand mode this paints once; edits repaint thereafter.

      Returns this

    • Pause presenting. The surface and device are kept; Viewport.start resumes.

      Returns this

    • Schedule a single frame (the damage signal). No-op while stopped.

      Returns this

    • Set the CSS size explicitly; unnecessary when autoResize is on.

      Parameters

      • cssWidth: number
      • cssHeight: number

      Returns this

    • The texture the engine last presented, for hosts that compose it into their own pipeline. Returns null in this build — the engine presents directly to the swapchain.

      Returns GPUTexture | null

    • Release this viewport's surface and swapchain (keeping the device) and stop the loop.

      Returns void