M
M
Maxim2020-01-17 17:32:24
JavaScript
Maxim, 2020-01-17 17:32:24

How to draw with canvas in a circle?

Changed the drawing area from a rectangle to a circle, now there is an error when drawing.
Example code sources
https://codepen.io/dus7/pen/qGQbVP
rolled up their styles

#sig-canvas {
  border: 1px solid $gray600;
  width: 188px;
  height: 188px;
  border-radius: 50%;
  cursor: crosshair;
}

the rest of the code, as on codepen
5e21c5323a32d231836196.png
What affects the position of the cursor in the canvas and how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2020-01-17
@maximkv25

Adjust canvas size in HTML attributes
<canvas id="sig-canvas" width="620" height="160">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question