diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-07-13 09:21:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-07-13 09:21:19 -0700 |
commit | d231f4d37d42ae6eeb14a27f5f3498ee80482fad (patch) | |
tree | 3ff68cde05d9ca5a7bb93993a6afe805e191c575 | |
parent | 22ad5373c5e4e4c68b4a9f8fcde83caee92237a2 (diff) | |
download | view.love-d231f4d37d42ae6eeb14a27f5f3498ee80482fad.tar.gz |
no, bring back that defense
Scenario where I ran into it: start a stroke inside a drawing press 'o' to switch to circle mode (but any mode switch will do) The problem is that Text.textinput unconditionally blows away all .y values. Sometimes we have to wait for a draw() to fill them back in.
-rw-r--r-- | drawing.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drawing.lua b/drawing.lua index 587c24c..38e62c3 100644 --- a/drawing.lua +++ b/drawing.lua @@ -241,6 +241,10 @@ function Drawing.update(State) if State.lines.current_drawing == nil then return end local drawing = State.lines.current_drawing assert(drawing.mode == 'drawing') + if drawing.y == nil then + -- something invalidated all the y's; just wait for a draw + return + end local pmx, pmy = App.mouse_x(), App.mouse_y() local mx = Drawing.coord(pmx-State.left, State.width) local my = Drawing.coord(pmy-drawing.y, State.width) |