Constructor for the Ctx2D class.
Retrieves the module's callbacks instance.
Checks if the canvas is ready to render.
The canvas element instance.
Returns the 2D rendering context
Current device pixel ratio.
Canvas height (DPR applied).
Indicates whether the instance has been destroyed.
After destruction, destroy is a no-op.
The name of the module, derived from the class name
Height without DPR scaling.
Width without DPR scaling.
Optional prefix for classnames used by the module
Current properties. Do not mutate these directly, use updateProps instead.
Canvas width (DPR applied).
Protected_addAdds prefixed classes to an element and removes them on destroy.
Skips classes that are already present on the element.
Target DOM element.
Unprefixed class name segments.
Protected_cnBuilds one or more prefixed class names.
Unprefixed class name segments.
Space-separated prefixed class string.
Protected_destroyDestroys the canvas.
Protected_emitSet default mutable props
Get default static props
Protected_handleAdds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Registers a function to run when the instance is destroyed.
If the instance is already destroyed, action runs immediately.
Cleanup function (for example remove listeners or DOM classes).
Renders content on the canvas if it's ready.
A function that performs the actual rendering on the canvas.
Triggers a canvas resize based on container or viewport dimensions.
A class for managing an HTML5 Canvas element and its 2D context.
Documentation