about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-03-23 21:38:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-03-23 21:38:33 -0700
commita6dcfc5ac862637719b35c0fda137fdb4015c540 (patch)
tree84f991428c505a70ccd1d6d3a986b75639d1b33b
parent99faf61abbd90f3d5da40788adc43c2883beb470 (diff)
downloadtext.love-a6dcfc5ac862637719b35c0fda137fdb4015c540.tar.gz
some minor cleanup
I can't see the mouse wheel ever setting dx, but it's more obvious now
that the editor doesn't support panning left/right.
-rw-r--r--edit.lua2
-rw-r--r--log_browser.lua2
-rw-r--r--run.lua4
-rw-r--r--source_edit.lua2
4 files changed, 5 insertions, 5 deletions
diff --git a/edit.lua b/edit.lua
index 3f87551..b894dde 100644
--- a/edit.lua
+++ b/edit.lua
@@ -310,7 +310,7 @@ function edit.mouse_wheel_move(State, dx,dy)
     for i=1,math.floor(dy) do
       Text.up(State)
     end
-  else
+  elseif dy < 0 then
     State.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos}
     for i=1,math.floor(-dy) do
       Text.down(State)
diff --git a/log_browser.lua b/log_browser.lua
index cd0d8fc..46d84c0 100644
--- a/log_browser.lua
+++ b/log_browser.lua
@@ -268,7 +268,7 @@ function log_browser.mouse_wheel_move(State, dx,dy)
     for i=1,math.floor(dy) do
       log_browser.up(State)
     end
-  else
+  elseif dy < 0 then
     for i=1,math.floor(-dy) do
       log_browser.down(State)
     end
diff --git a/run.lua b/run.lua
index ae78d9b..17477ea 100644
--- a/run.lua
+++ b/run.lua
@@ -163,9 +163,9 @@ function run.mouse_release(x,y, mouse_button)
   return edit.mouse_release(Editor_state, x,y, mouse_button)
 end
 
-function run.mouse_wheel_move(x,y)
+function run.mouse_wheel_move(dx,dy)
   Cursor_time = 0  -- ensure cursor is visible immediately after it moves
-  return edit.mouse_wheel_move(Editor_state, x,y)
+  return edit.mouse_wheel_move(Editor_state, dx,dy)
 end
 
 function run.text_input(t)
diff --git a/source_edit.lua b/source_edit.lua
index 60ed027..b70aab1 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -311,7 +311,7 @@ function edit.mouse_wheel_move(State, dx,dy)
     for i=1,math.floor(dy) do
       Text.up(State)
     end
-  else
+  elseif dy < 0 then
     State.cursor1 = {line=State.screen_bottom1.line, pos=State.screen_bottom1.pos}
     for i=1,math.floor(-dy) do
       Text.down(State)