Skip to main content

Viewport API Reference

kittl.state.viewport — read and update the canvas viewport.

Scope: design:state:read (get) · design:state:write (set)

get()

Returns the full viewport state (coordinates, transform, zoom, position).

Returns: SdkResultAsync<ViewportState>

set(patch)

Patches multiple viewport properties at once. Accepts exactly one of three mutually exclusive shapes:

ViewportPatch

VariantPropertiesDescription
Transform-driven{ transform }Set the full 6-value transformation matrix directly
Zoom-driven{ zoom, position? }Set zoom level, optionally with a pan position
Pan-only{ position }Pan without changing zoom

Note: These variants are mutually exclusive — you cannot combine transform with zoom or position in the same call.