Function: getOrCreateCanvas()
getOrCreateCanvas(
element
):HTMLCanvasElement
Create a canvas or returns the one that already exists for a given element. It first checks if the element has a canvas, if not it creates one and returns it. The canvas is updated for:
- width/height in screen pixels to completely cover the div element
- CSS width/height in CSS pixels to be the size of the physical screen pixels width and height (from #1) This allows drawing to the canvas and having pixel perfect/exact drawing to the physical screen pixels.
Parameters
• element: HTMLDivElement
An HTML Element
Returns
HTMLCanvasElement
canvas a Canvas DOM element
Defined in
packages/core/src/RenderingEngine/helpers/getOrCreateCanvas.ts:56