several bugfixes

All introduced when I built rectangles and squares in commit e27165cb.
This commit is contained in:
Kartik K. Agaram 2022-05-21 08:40:15 -07:00
parent 10c961855a
commit 5d8e7a3cc6
2 changed files with 9 additions and 2 deletions

View File

@ -171,6 +171,8 @@ function Drawing.draw_pending_shape(left,top, drawing)
shape.end_angle = geom.angle_with_hint(center.x,center.y, mx,my, shape.end_angle)
local cx,cy = Drawing.pixels(center.x)+left, Drawing.pixels(center.y)+top
love.graphics.arc('line', 'open', cx,cy, Drawing.pixels(shape.radius), shape.start_angle, shape.end_angle, 360)
elseif shape.mode == 'move' then
-- nothing pending; changes are immediately committed
else
print(shape.mode)
assert(false)
@ -195,6 +197,8 @@ function Drawing.mouse_pressed(drawing, x,y, button)
elseif Current_drawing_mode == 'circle' then
local j = Drawing.insert_point(drawing.points, Drawing.coord(x-16), Drawing.coord(y-drawing.y))
drawing.pending = {mode=Current_drawing_mode, center=j}
elseif Current_drawing_mode == 'move' then
-- all the action is in mouse_released
else
print(Current_drawing_mode)
assert(false)
@ -225,8 +229,7 @@ function Drawing.update()
drawing.pending.target_point.y = my
end
else
print(Current_drawing_mode)
assert(false)
-- do nothing
end
end

View File

@ -12,6 +12,10 @@ backspace
cursor_pos == 0, previous line is a drawing -> delete drawing, cursor still visible at start of line
cursor_pos == 0, previous line is text -> join lines, cursor still at same character
drawing
draw a line, circle, rectangle, square, polygon
select a point and move it
enter
cursor_pos == 0 -> insert empty line above current line