Blocks

Understanding the block system in Editx Engine.

Block Types

Every element in the scene is a block. Each block has a type, optional kind, properties, and can participate in a parent-child hierarchy.

TypeDescription
sceneRoot container
pageCanvas page
graphicShape with fill (rect, ellipse, line, etc.)
textRich text annotation
imageImage layer
groupNested grouping container
effectEffect sub-block (adjustments, filter)
shapeShape sub-block (rect, ellipse, polygon, etc.)
fillFill sub-block (solid color, image fill)

Sub-blocks

Graphic blocks own sub-blocks for their visual properties:

  • Shape — defines geometry (rect, ellipse, polygon, star, line, path)
  • Fill — defines appearance (color, gradient, image)
  • Effects — stackable effects (adjustments, filter)

Groups own child blocks rather than visual sub-blocks. Group membership preserves each child's editable shape, fill, text, and transform. See the Groups API.

Properties

Blocks store typed key-value properties. Access them through the BlockAPI:

engine.block.getFloat(blockId, "transform/position/x");
engine.block.getString(blockId, "text/fontFamily");
engine.block.getBool(blockId, "appearance/visible");
engine.block.getColor(blockId, "fill/color");

PropertyValue supports numbers, strings, booleans, colors, text runs, and gradient-stop arrays. Prefer semantic APIs for compound values because they keep related property writes atomic. Shape and image-fill methods additionally validate or normalize their descriptors:

engine.block.setShapeGeometry(graphicId, { type: "polygon", sides: 6 });
engine.block.setFillGradient(graphicId, {
	type: "radial",
	angle: 0,
	stops: [
		{ offset: 0, color: "#ffffff" },
		{ offset: 1, color: "#2563eb" },
	],
});

See Graphics API for graphics properties and Text API for run and background properties.