Commit Graph

12 Commits

Author SHA1 Message Date
Kartik K. Agaram 9c72ff1bb4 bugfix: propagate mouse press if any button would
Before this commit I was propagating press events only if _all_ buttons
would.
2022-08-24 13:40:36 -07:00
Kartik K. Agaram b6f42ebf01 pass all button params to the icon 2022-08-23 12:13:22 -07:00
Kartik K. Agaram 8747415461 allow buttons to nest as well 2022-08-23 11:48:52 -07:00
Kartik K. Agaram 468b791050 flip return value of button handlers
This is compatible with Javascript, and it also seems like a better
default; when people forget to think about return values in click
handlers, they should be consumed.
2022-08-23 11:43:10 -07:00
Kartik K. Agaram 8057f3e8fe 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.
2022-08-23 10:59:58 -07:00
Kartik K. Agaram ce79623231 improve explanation for buttons 2022-08-23 09:44:16 -07:00
Kartik K. Agaram aadc50f3b6 allow buttons to interrupt events
Most button onpress1 handlers will want to return true.
2022-08-23 09:40:48 -07:00
Kartik K. Agaram 490f10c6f8 indent 2022-08-23 09:37:38 -07:00
Kartik K. Agaram dc618a419c highlight another global 2022-05-17 23:24:46 -07:00
Kartik K. Agaram 6e152a9f3f . 2022-05-17 23:18:56 -07:00
Kartik K. Agaram 07e2b7b897 fix a typo 2022-05-12 08:27:41 -07:00
Kartik K. Agaram 475bbd70ef intermingle freehand line drawings with text 2022-05-11 13:01:13 -07:00