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).
Checks if the module has been destroyed.
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 a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected_destroyDestroys the canvas.
Get default mutable properties
Get default static properties
Protected_handleProtected_setSet events
Destroys the module, cleaning up resources, callbacks, and event listeners.
Adds 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.
Adds a callback on the module's destruction.
The function to execute during destruction.
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