plotters-canvas icon indicating copy to clipboard operation
plotters-canvas copied to clipboard

Improved canvas size getter to support high-dpi

Open jiakuan opened this issue 2 years ago • 0 comments

In order to support high-dpi in HTML canvas, we need to scale the canvas size by devicePixelRatio first, and then use CSS style to configure the actual size, please see: https://www.kirupa.com/canvas/canvas_high_dpi_retina.htm

The Canvas scaling part can be handled outside of this library, but in the get_size function, we need to get the size from the computed style, not the canvas, which may have been scaled.

jiakuan avatar Dec 08 '22 03:12 jiakuan