diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-21 08:40:15 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-21 08:41:54 -0700 |
commit | 5d8e7a3cc6bde06cd8ef79bae66538b22d34b957 (patch) | |
tree | 90d49901aed3507f4984748f47b9cb11b5d1419c | |
parent | 10c961855aa432e4a1341fffbc7ee513f5d9e439 (diff) | |
download | text.love-5d8e7a3cc6bde06cd8ef79bae66538b22d34b957.tar.gz |
several bugfixes
All introduced when I built rectangles and squares in commit e27165cb.
-rw-r--r-- | drawing.lua | 7 | ||||
-rw-r--r-- | manual_tests | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drawing.lua b/drawing.lua index cb5ec6f..b7a0d3b 100644 --- a/drawing.lua +++ b/drawing.lua @@ -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 diff --git a/manual_tests b/manual_tests index 36ea677..d16758f 100644 --- a/manual_tests +++ b/manual_tests @@ -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 |