[]
Core interface representing a paint object that can be rendered on canvas.
T
The specific type of paint object (e.g., 'rectangle', 'line')
readonly type: T;
The type identifier of the paint object (e.g., 'line', 'rectangle')
readonly name: string;
The display name of the paint object
readonly bounds: Bounds;
Gets the bounding rectangle of the object in canvas coordinates
readonly startPosition: PointLocation;
Gets the end position (particularly relevant for line objects)
readonly endPosition: PointLocation;
Gets the end position (particularly relevant for line objects)
readonly canvasPadding: number;
Returns the additional padding (in pixels) required around the object to accommodate all visual elements like styled line caps. This is useful for properly sizing the canvas when rendering this object.
draw(
destCtx,
mainCtx,
backCtx,
params?): Promise<void>;
Renders the object to the specified canvas context
CanvasRenderingContext2D
Primary drawing context
CanvasRenderingContext2D
Main canvas context (for composite operations)
CanvasRenderingContext2D
Background context (for layered rendering)
Optional rendering parameters
Promise<void>
getContentSize(ctx): Size;
Calculates the content dimensions of the object
CanvasRenderingContext2D
Canvas context used for measurements (e.g., text metrics)
Size object containing width and height
getProperty<K>(propertyName): any;
Retrieves a property value by name
K extends PaintObjectPropertyName
Type of the property name
K
Name of the property to retrieve
any
The property value or undefined if not found
setProperty<K>(propertyName, value): boolean;
Updates a property value by name
K extends PaintObjectPropertyName
Type of the property name
K
Name of the property to set
any
New value for the property
boolean
True if the property was changed, false otherwise
resetToFactoryDefaults(): void;
Resets all user-modified properties of the object back to their registered factory default values.
void