driver.love/0018-on.update

30 lines
734 B
Plaintext

on.update = function(dt)
refresh_debug_animations()
if Animating then
animate_next(dt)
return
end
if Pan then
set_mouse_cursor('hand')
elseif Move or on_handle(App.mouse_x(), App.mouse_y()) then
set_mouse_cursor('crosshair')
else
set_mouse_cursor('arrow')
end
if Pan then
Viewport.x = Pan.x - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.y - App.mouse_y()/Viewport.zoom
B()
return
end
if Move then
Move.node.x = sx(App.mouse_x()-Move.xoff)
Move.node.y = sy(App.mouse_y()-Move.yoff)
-- quantize the x axis to discrete columns
Move.node.x = round(Move.node.x/100)*100
A1(Move.node.key)
Move.node.pos.x = Move.node.x+Move.node.w/2
Move.node.pos.y = Move.node.y+Move.node.h/2+30
return
end
end