diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-07-01 11:42:54 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-07-01 11:42:54 -0700 |
commit | 79df3da04be029ee4470638917c1b5f305a6c089 (patch) | |
tree | ab49afc3f57c01e71e4f1dc1dc56f872b5cc2de4 /main.lua | |
parent | e839c3036a24eee998fa2c7e1a47ac4d53a2b089 (diff) | |
download | lines.love-79df3da04be029ee4470638917c1b5f305a6c089.tar.gz |
enforce press/release state only processed once
bugfix scenario: press pageup click somewhere near the bottom Before this change the selection was flickering when doing this.
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/main.lua b/main.lua index a6674be..32b2845 100644 --- a/main.lua +++ b/main.lua @@ -326,7 +326,7 @@ end function App.mousepressed(x,y, mouse_button) if Search_term then return end ---? print('press') +--? print('press', Selection1.line, Selection1.pos) propagate_to_button_handlers(x,y, mouse_button) for line_index,line in ipairs(Lines) do @@ -345,7 +345,8 @@ function App.mousepressed(x,y, mouse_button) Old_selection1 = Selection1 Mousepress_shift = App.shift_down() Selection1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)} ---? print('selection') +--? print('selection', Selection1.line, Selection1.pos) + break end elseif line.mode == 'drawing' then if Drawing.in_drawing(line, x, y) then @@ -353,6 +354,7 @@ function App.mousepressed(x,y, mouse_button) Lines.current_drawing = line Drawing.before = snapshot(line_index) Drawing.mouse_pressed(line, x,y, button) + break end end end @@ -374,7 +376,7 @@ function App.mousereleased(x,y, button) if Text.in_line(line_index,line, x,y) then --? print('reset selection') Cursor1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)} ---? print(Cursor1.line, Cursor1.pos) +--? print('cursor', Cursor1.line, Cursor1.pos) if Mousepress_shift then if Old_selection1.line == nil then Selection1 = Old_cursor1 @@ -383,10 +385,11 @@ function App.mousereleased(x,y, button) end end Old_cursor1, Old_selection1, Mousepress_shift = nil + break end end end ---? print('select:', Selection1.line, Selection1.pos) +--? print('selection:', Selection1.line, Selection1.pos) end end |