Skip to main content
Commands flow from the driver to Drawdy. Each entry below lists the type, its request req, and its response res.value. A dash means none.

Camera

fly-to-rect’s zoom is the maximum zoom; the camera fits the rect. get-viewport-rect returns the visible canvas area in canvas coordinates.

Scene: elements

  • When updating, meta is merged into the element’s existing meta; every other property is set as given. See UpdateableProperties.
  • query-combined-rect returns the union of the elements’ bounding rects, or null when none of the ids exist.
  • The properties you pass to get-drawdy-elements and query-rect select which fields come back on each SubscribedDrawdyElement.

Scene: preview elements

Preview elements are ephemeral: they render but are not committed to the scene.

Scene: preview transforms

A separate lifecycle for animating existing elements without touching undo history or collaboration until you commit. begin-preview snapshots each element’s rest geometry and moves it onto the animation layer; preview-transforms bakes per-tick deltas from that rest pose into real local geometry silently (nothing syncs, enters undo, or echoes as a scene event — but hit-testing and selection follow); end-preview restores non-committed elements, optionally baking final deltas as one undo step and one sync.
  • began is the subset of ids that entered preview. Grouped elements are rejected — their rotation pivot is the group center.
  • In end-preview, elements listed in commits are baked as one undo step; elements absent are restored. dRotation is radians about the element’s bounding-box center.
See PreviewTransform.

Scene: text editing

update-text-edit replaces the text of the active text edit in place, keeping the editor open so the user can keep typing. updated is false when no text edit is in progress.

Tools

See ToolId, StyleableToolId, and ToolStyleState.

Context menus

Subscribe to subscription:context-menu:clicked to know when a menu item is chosen.

DOM

Drawdy exposes a handful of host-DOM primitives for buttons, floating panels, and window geometry.
  • create-action-button currently accepts svg only; other formats may come later.
  • create-floating-element’s position is a fixed position in the DOM. When barrierDismissible is true, clicking outside dismisses it (same effect as dom:remove-element); the driver is not notified — poll dom:element-rect if you need to know. Defaults to false.
  • enter-fullscreen returns entered: false when the browser refused or doesn’t support it; exit-fullscreen returns exited: false when the document wasn’t fullscreen.

Webviews

A webview is an isolated HTML document Drawdy hosts for you. Two-way messaging goes through the webview API.
  • When keepStateWhenClosed is true, closing the webview only hides it — it stays active and dies with the tab, at the cost of resources. Prefer stateless webviews.
  • post-message returns posted: false when the webview doesn’t exist or isn’t connected yet.
  • Receive messages from the webview by subscribing to subscription:webview:message.

Storage

Two key/value stores scoped to your driver. kv-storage is plain; secure-storage is for secrets.

History

Subscription management

Pass the subscriptionId you received when you set the subscription up. See Subscriptions.