snap.love/0018-on.update

34 lines
850 B
Plaintext

on.update = function(dt)
if Global_next_save and Global_next_save < Current_time then
save_graph_to_disk()
Global_next_save = nil
end
if Pan then
Viewport.x = Pan.sx - App.mouse_x()/Viewport.zoom
Viewport.y = Pan.sy - App.mouse_y()/Viewport.zoom
B()
return
end
local sx = sx(App.mouse_x())
local sy = sy(App.mouse_y())
if Edge then
Edge.s = intersect_with_centroid(Edge.source, sx,sy)
Edge.e = {sx=sx, sy=sy}
elseif Move_node then
Move_node.x = sx - Move.sx
Move_node.y = sy - Move.sy
A1(Move_node.id)
elseif Resize_node then
Resize_node.width = math.max(30, sx - Resize.sx)
A1(Resize_node.id)
elseif on_move_bar(sx, sy) then
set_mouse_cursor('crosshair')
elseif on_resize(sx, sy) then
set_mouse_cursor('sizewe')
elseif on_edge(sx,sy) then
set_mouse_cursor('no')
else
set_mouse_cursor('arrow')
end
end