From d231f4d37d42ae6eeb14a27f5f3498ee80482fad Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 13 Jul 2022 09:21:19 -0700 Subject: 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. --- drawing.lua | 4 ++++ 1 file changed, 4 insertions(+) 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) -- cgit 1.4.1-2-gfad0