From c1d8201d4436b7d2544b79dbe0465558f887fd18 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 14 Jun 2022 09:05:02 -0700 Subject: mouse buttons are integers, not strings Not sure where that idiom comes from or why strings work in some places (auto-coercion?). I picked it up off some example apps. But https://love2d.org/wiki/love.mouse.isDown says it should be an integer. --- main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index bc5d45a..db5d1ba 100644 --- a/main.lua +++ b/main.lua @@ -55,7 +55,7 @@ Cursor1 = {line=1, pos=1} -- position of cursor Screen_bottom1 = {line=1, pos=1} -- position of start of screen line at bottom of screen Selection1 = {} -Old_cursor1, Old_selection1, Mousepress_shift = nil -- some extra state to compute selection between mousepress and mouserelease +Old_cursor1, Old_selection1, Mousepress_shift = nil -- some extra state to compute selection between mouse press and release Recent_mouse = {} -- when selecting text, avoid recomputing some state on every single frame Cursor_x, Cursor_y = 0, 0 -- in pixels @@ -450,7 +450,7 @@ function App.keychord_pressed(chord) save_to_disk(Lines, Filename) record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)}) -- dispatch to drawing or text - elseif App.mouse_down('1') or chord:sub(1,2) == 'C-' then + elseif App.mouse_down(1) or chord:sub(1,2) == 'C-' then -- DON'T reset line.y here local drawing_index, drawing = Drawing.current_drawing() if drawing_index then @@ -459,12 +459,12 @@ function App.keychord_pressed(chord) record_undo_event({before=before, after=snapshot(drawing_index)}) save_to_disk(Lines, Filename) end - elseif chord == 'escape' and App.mouse_down('1') then + elseif chord == 'escape' and App.mouse_down(1) then local _,drawing = Drawing.current_drawing() if drawing then drawing.pending = {} end - elseif chord == 'escape' and not App.mouse_down('1') then + elseif chord == 'escape' and not App.mouse_down(1) then for _,line in ipairs(Lines) do if line.mode == 'drawing' then line.show_help = false -- cgit 1.4.1-2-gfad0