Class: CanvasObserver
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:8
Internal
CanvasObserver class synchronizes the DOM element's transform with the canvas size and position. It uses ResizeObserver for efficient updates and requestAnimationFrame for fallback. This ensures that the DOM element is always correctly positioned and scaled relative to the canvas.
Constructors
Constructor
> new CanvasObserver(options): CanvasObserver
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:25
Parameters
options
domElement
HTMLElement
renderer
Returns
CanvasObserver
Properties
updateTranslation
> readonly updateTranslation: () => void
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:37
Updates the transform of the DOM element based on the canvas size and position. This method calculates the scale and translation needed to keep the DOM element in sync with the canvas.
Returns
void
Accessors
canvas
Get Signature
> get canvas(): HTMLCanvasElement
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:30
The canvas element that this CanvasObserver is associated with.
Returns
HTMLCanvasElement
Methods
destroy()
> destroy(): void
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:41
Destroys the CanvasObserver instance, cleaning up observers and Ticker.
Returns
void
ensureAttached()
> ensureAttached(): void
Defined in: node_modules/pixi.js/lib/dom/CanvasObserver.d.ts:32
Attaches the DOM element to the canvas parent if it is not already attached.
Returns
void