FormCanvasBlock class

A live canvas scene embed.

Unlike FormImageBlock (static bitmap) or FormChartBlock (structured data), this block references a scene in the host project and is rendered against the current project state at document render time by a CanvasBindingResolver. Typical uses: embed a schematic page, a PCB top view, a mechanical 3D assembly, or a generated UI preview inside a design-spec document.

The block is format-agnostic at the data layer: it carries a target reference plus render hints. The host (e.g. Designer) wires a resolver that knows how to project the current scene into bytes of the requested format. Renderers that cannot consume vector output fall back to fallback — typically a bitmap.

Inheritance

Constructors

FormCanvasBlock({required String blockId, required int index, Map<String, dynamic>? style, required String target, String mode = 'canvas', String format = 'svg', String fallback = 'bitmap', Map<String, dynamic>? viewport, double? maxWidth, double? aspectRatio, String? caption, String? alt})
FormCanvasBlock.fromJson(Map<String, dynamic> json)
factory

Properties

alt String?
Alternative text for accessibility / fallback text formats.
final
aspectRatio double?
Aspect ratio (width / height). Enforced by the renderer so page layout stays stable across scene updates.
final
blockId String
Unique block identifier.
finalinherited
caption String?
Optional caption — rendered below the scene by most renderers.
final
fallback String
Fallback strategy when format is not supported by the active renderer. 'bitmap' (default) raster-rasterises into PNG at the block's physical size; 'skip' emits a placeholder.
final
format String
Preferred output format. One of: 'svg', 'png', 'pdf-vector', 'json'. If the active document renderer does not support the requested format it SHOULD downgrade via fallback.
final
hashCode int
The hash code for this object.
no setterinherited
index int
Block ordering index.
finalinherited
maxWidth double?
Maximum rendered width in logical pixels (renderer decides how to scale if narrower, e.g. to fit document width).
final
mode String
Canvas editor mode the resolver should render in. One of: 'canvas' (2D/3D engineering), 'ui' (UI editor runtime), 'form' (nested document — resolver may reject).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style Map<String, dynamic>?
Optional style properties.
finalinherited
target String
Scene reference — resolver-specific. Examples: canvas://schematic.main canvas://pcb.top-view canvas://mechanical.assembly#exploded
final
type FormBlockType
Type of this block.
finalinherited
viewport Map<String, dynamic>?
Optional viewport hint — resolver-specific map (e.g. {zoom: 1.2, center: [x, y]}). Opaque to mcp_form; passed through to the resolver.
final

Methods

baseToJson() Map<String, dynamic>
Serialize common base fields to a map.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert to JSON.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited