support mouse wheel

This commit is contained in:
Kartik K. Agaram 2023-06-18 22:18:53 -07:00
parent b995a020aa
commit 3afcdbc8db
1 changed files with 30 additions and 0 deletions

30
0110-on.mouse_wheel_move Normal file
View File

@ -0,0 +1,30 @@
on.mouse_wheel_move = function(dx, dy)
if App.shift_down() then
-- shift+scroll wheel doesn't set dx for me; manually do so if necessary
if dx == 0 then
dx,dy = dy,dx
end
end
if dy > 0 then
for i = 1,math.floor(dy) do
Viewport.y = Viewport.y - scale(200)
end
B()
elseif dy < 0 then
for i = 1,math.floor(-dy) do
Viewport.y = Viewport.y + scale(200)
end
B()
end
if dx > 0 then
for i = 1,math.floor(dx) do
Viewport.x = Viewport.x - scale(500)
end
B()
elseif dx < 0 then
for i = 1,math.floor(-dx) do
Viewport.x = Viewport.x + scale(500)
end
B()
end
end