[]
Core interface representing a paint object that can be rendered on canvas.
T
extends PaintObjectType
= PaintObjectType
The specific type of paint object (e.g., 'rectangle', 'line')
readonly name: string;
The display name of the paint object
readonly type: T;
The type identifier of the paint object (e.g., 'line', 'rectangle')
get bounds(): Bounds;
Gets the bounding rectangle of the object in canvas coordinates
Bounds
set bounds(bounds): void;
Sets the bounding rectangle of the object
Bounds
New bounding rectangle dimensions and position
void
get 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.
number
get endPosition(): PointLocation;
Gets the end position (particularly relevant for line objects)
set endPosition(pos): void;
Sets the end position (particularly relevant for line objects)
New end position coordinates
void
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
resetToFactoryDefaults(): void;
Resets all user-modified properties of the object back to their registered factory default values.
void
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