plotters-canvas
plotters-canvas copied to clipboard
Improved canvas size getter to support high-dpi
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.