pothi.love/0110-on.mouse_wheel_move

31 lines
602 B
Plaintext

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