support mouse wheel
This commit is contained in:
parent
b995a020aa
commit
3afcdbc8db
|
@ -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
|
Loading…
Reference in New Issue