Skip to main content

DriverElement

The elements you add to the canvas with scene:add-drawdy-elements and preview commands. All variants share a common base:
  • shape.roughness: 0 is crisp, higher is sketchier. text is a label rendered inside the shape.
  • line.bend curves the line through one control point (quadratic) or several (through every bend, in order). arrow.bend curves the shaft through a single control point.
  • text.width/height are optional and can be measured later.

ElementSchema

The declarative UI tree for floating elements. Layout primitives nest via children; leaves carry a child.
For image, child is the image URL and may be an SVG string. domId gives an element a handle you can target with DOM commands and click subscriptions.

Element properties

The property set you can read back from the scene and update on it.
When you query or subscribe you pass a list of SubscribeableKey; each returned SubscribedDrawdyElement carries id plus exactly the properties you asked for. Updates are a partial patch:
meta merges into existing meta; localTransform.rotation is applied on top of the element’s starting rotation.

ModuleStyling

The theme handed to activate and re-delivered on subscription:dom:theme-changed. Each field is a resolved CSS value string.
For example, { theme: "light", background: "#fff", radiusSm: "2px", ... }.

ToolStyleState

The style state of a built-in tool, returned by scene:query-tool-state.
StyleableToolId is the subset of ToolId that ToolStyleState covers.

PreviewTransform

A pose delta from an element’s rest pose, used by scene:preview-transforms.
x/y are a world-space translation; rotation (radians) is applied on top of the element’s rest rotation about its bounding-box center. scale is reserved and currently ignored.

CSS units

Dimension values pair a number with a CSSUnit:
The full CSSFontUnit, CSSViewportUnit, CSSFrequencyUnit, and CSSResolutionUnit unions are exported as well; see css-unit.ts in the package.