I have a canvas that is 1400px wide and around 12000px long. I have a hierarchy diagram that I need to draw. When it is expanded fully, it takes up the entire canvas (the size that I have set).
Now this works fine when I access the page from laptop (on various browsers).
But when I access it fron Safari on iPad, the canvas does not show up, or the content on the canvas is not visible. I think, this is due to the large size of the canvas.
So, it seems, memory availability or device dependency is there, that limits the size (withing the allowed size as per W3C).
How to know or calculate the size? Or is there some workarounds? Is there any other way round? I am a beginner.
The width attribute specifies the width of the <canvas> element, in pixels. Tip: Use the height attribute to specify the height of the <canvas> element, in pixels.
We can create canvas elements that exceed 4096 pixels in width or height as long as the total amount of pixels is below 16777216. const canvas = document.
Canvas has two sizes, the size of the element and the size of the drawing surface. The default size for both element and drawing surface is 300 x 150 screen pixels. To set the height and width canvas HTML5 has two attributes: Height: With the help of Height attribute we can set the height.
Alternative ways (anwsering the comment):
These are just proposals, not tested on real data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With