clean up a slight jitter when drawing circles

Earlier the ghost while drawing wouldn't quite match the final shape.
Now the math is identical in draw_pending_shape.

It's a little unfortunate that we have this duplication of formulae.

At least there are no other stray calls of App.mouse_x in
draw_pending_shape.
This commit is contained in:
Kartik K. Agaram 2023-09-15 08:24:54 -07:00
parent 1fd30c0462
commit 0e20565e17
1 changed files with 2 additions and 1 deletions

View File

@ -191,8 +191,9 @@ function Drawing.draw_pending_shape(drawing, top, left,right)
if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h then
return
end
local r = round(geom.dist(center.x, center.y, mx, my))
local cx,cy = px(center.x), py(center.y)
love.graphics.circle('line', cx,cy, geom.dist(cx,cy, App.mouse_x(),App.mouse_y()))
love.graphics.circle('line', cx,cy, Drawing.pixels(r, width))
elseif shape.mode == 'arc' then
local center = drawing.points[shape.center]
if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h then