diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-23 09:40:48 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-23 09:40:48 -0700 |
commit | aadc50f3b6d953ce0eaff75dec029aaf3a93324a (patch) | |
tree | 67651c0c301a6ea2af18441c4e6ca3ca4814fa67 /edit.lua | |
parent | 490f10c6f8f38cc83264c38dd93e32d471530880 (diff) | |
download | text.love-aadc50f3b6d953ce0eaff75dec029aaf3a93324a.tar.gz |
allow buttons to interrupt events
Most button onpress1 handlers will want to return true.
Diffstat (limited to 'edit.lua')
-rw-r--r-- | edit.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/edit.lua b/edit.lua index 9a7674d..5bc8bad 100644 --- a/edit.lua +++ b/edit.lua @@ -162,6 +162,7 @@ function edit.draw(State) end schedule_save(State) record_undo_event(State, {before=Drawing.before, after=snapshot(State, line_index-1, line_index+1)}) + return true -- don't handle any other events with this mouse button press end, }) end @@ -207,7 +208,10 @@ end function edit.mouse_pressed(State, x,y, mouse_button) if State.search_term then return end --? print('press', State.selection1.line, State.selection1.pos) - propagate_to_button_handlers(x,y, mouse_button) + if propagate_to_button_handlers(x,y, mouse_button) then + -- press on a button and it returned 'true' to short-circuit + return + end for line_index,line in ipairs(State.lines) do if line.mode == 'text' then |