LayerType Enum
Defines the different types of visual elements that can be rendered on the canvas.Rectangular shape layer
Elliptical/circular shape layer
Free-form drawing path layer created with pencil tool
Text content layer
Sticky note layer
Layer Types
Each layer type shares common properties for positioning and appearance, with specific properties for specialized functionality.RectangleLayer
Represents a rectangular shape on the canvas.Layer type discriminator
X coordinate of the layer’s top-left corner
Y coordinate of the layer’s top-left corner
Height of the rectangle in pixels
Width of the rectangle in pixels
Fill color of the rectangle. See Color type.
Optional text content associated with the layer
EllipseLayer
Represents an elliptical or circular shape on the canvas.Layer type discriminator
X coordinate of the bounding box’s top-left corner
Y coordinate of the bounding box’s top-left corner
Height of the bounding box in pixels
Width of the bounding box in pixels
Fill color of the ellipse. See Color type.
Optional text content associated with the layer
PathLayer
Represents a free-form drawing path created with the pencil tool.Layer type discriminator
X coordinate of the bounding box’s top-left corner
Y coordinate of the bounding box’s top-left corner
Height of the bounding box in pixels
Width of the bounding box in pixels
Stroke color of the path. See Color type.
Array of [x, y] coordinate pairs representing the path points
Optional text content associated with the layer
TextLayer
Represents a text content layer on the canvas.Layer type discriminator
X coordinate of the text box’s top-left corner
Y coordinate of the text box’s top-left corner
Height of the text box in pixels
Width of the text box in pixels
Text color. See Color type.
The text content to display
NoteLayer
Represents a sticky note layer on the canvas.Layer type discriminator
X coordinate of the note’s top-left corner
Y coordinate of the note’s top-left corner
Height of the note in pixels
Width of the note in pixels
Background color of the note. See Color type.
The note text content
Layer Union Type
TheLayer type is a discriminated union of all layer types, enabling type-safe layer handling.