diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2025-05-06 13:41:31 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2025-05-06 14:14:55 -0700 |
commit | 11cd9123c15f9b9e76c359a8ac672c21f299811a (patch) | |
tree | e3a234e8df50ff96e1aa1f78eb612f3e1e6cc461 /source_edit.lua | |
parent | bac6c8ae8710099014236029d1fab1f71394a4c5 (diff) | |
download | text.love-11cd9123c15f9b9e76c359a8ac672c21f299811a.tar.gz |
plumb through all supported args in LÖVE handlers
I just noticed that the is_touch arg in mouse handlers is extremely useful for arbitrating between events on a mobile device. And I'd totally forgotten about its existence X-(
Diffstat (limited to 'source_edit.lua')
-rw-r--r-- | source_edit.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source_edit.lua b/source_edit.lua index 91bcb58..77487ea 100644 --- a/source_edit.lua +++ b/source_edit.lua @@ -232,7 +232,7 @@ function edit.quit(State) end end -function edit.mouse_press(State, x,y, mouse_button) +function edit.mouse_press(State, x,y, mouse_button, is_touch, presses) if State.search_term then return end State.mouse_down = mouse_button --? print_and_log(('edit.mouse_press: cursor at %d,%d'):format(State.cursor1.line, State.cursor1.pos)) @@ -279,7 +279,7 @@ function edit.mouse_press(State, x,y, mouse_button) State.lines.current_drawing_index = line_index State.lines.current_drawing = line Drawing.before = snapshot(State, line_index) - Drawing.mouse_press(State, line_index, x,y, mouse_button) + Drawing.mouse_press(State, line_index, x,y, mouse_button, is_touch, presses) return end end @@ -292,12 +292,12 @@ function edit.mouse_press(State, x,y, mouse_button) State.selection1 = Text.final_text_loc_on_screen(State) end -function edit.mouse_release(State, x,y, mouse_button) +function edit.mouse_release(State, x,y, mouse_button, is_touch, presses) if State.search_term then return end --? print_and_log(('edit.mouse_release: cursor at %d,%d'):format(State.cursor1.line, State.cursor1.pos)) State.mouse_down = nil if State.lines.current_drawing then - Drawing.mouse_release(State, x,y, mouse_button) + Drawing.mouse_release(State, x,y, mouse_button, is_touch, presses) if Drawing.before then record_undo_event(State, {before=Drawing.before, after=snapshot(State, State.lines.current_drawing_index)}) Drawing.before = nil @@ -383,7 +383,7 @@ function edit.text_input(State, t) schedule_save(State) end -function edit.keychord_press(State, chord, key) +function edit.keychord_press(State, chord, key, scancode, is_repeat) if State.selection1.line and not State.lines.current_drawing and -- printable character created using shift key => delete selection @@ -502,7 +502,7 @@ function edit.keychord_press(State, chord, key) local drawing_index, drawing = Drawing.current_drawing(State) if drawing_index then local before = snapshot(State, drawing_index) - Drawing.keychord_press(State, chord) + Drawing.keychord_press(State, chord, key, scancode, is_repeat) record_undo_event(State, {before=before, after=snapshot(State, drawing_index)}) schedule_save(State) end @@ -535,7 +535,7 @@ function edit.keychord_press(State, chord, key) end schedule_save(State) else - Text.keychord_press(State, chord) + Text.keychord_press(State, chord, key, scancode, is_repeat) end end |