Drawing ellipses in Canvas is a very common requirement. The relatively new HTML Canvas 2D Context W3C draft has added the ellipse method to draw ellipses. However, most browsers have not yet implemented this method, so you need to use arc or arcTo. Method combines scale deformation to draw ellipses.
Sample code:
To fix this problem, you need a little trick.
Sample code:
The trick is to save the canvas state first, then zoom and call the path command, then restore to restore the canvas state, and then stroke to draw it.
The key point is to save first and then scale, and restore first and then stroke.