Fork of lines.love with some tweaks specific to mobile devices

stop putting button state in a global

Symptom: a test (test_click_to_create_drawing) started randomly failing after I inserted a return 2 commits ago.

Cause: my tests call edit.draw, but button handlers only get cleared in app.draw. So my tests weren't clearing button handlers, and every call to edit.draw was accumulating states. Still unclear why those were going to different state objects after the return, but anyway. I'm not going to understand every last thing that happens when things go wrong, just guarantee they can't go wrong. And the way to do that is to decentralize button handlers to each state that receives them.

The State object in buttons.lua doesn't have to be Editor_state. It just has to be some table that provides a Schelling Point for shared state.

Created by  Kartik K. Agaram  on August 23, 2022
PP2IIHL6EK4HBFFSYAQNV35BKIK6D4EL2JQOY7NZVJX2DXCLSMGAC
Change contents