wardley.love/0040-A1

23 lines
663 B
Plaintext

A1 = function(id)
-- like A, but translate a single node in Nodes to Surface
-- this only works because Nodes is a flat array; we don't support row/col types here yet
-- delete previously added shapes for this node:
for i=#Surface,1,-1 do
local x = Surface[i]
if x.id == id or (x.keys and table.find(x.keys, id)) then
table.remove(Surface, i)
end
end
-- translate Nodes to Surface
local node = Nodes[id]
compute_layout(node, node.x,node.y, Surface)
for _,d in ipairs(node.outgoing_edges) do
compute_layout_for_edge(id, d)
end
for _,s in ipairs(node.incoming_edges) do
compute_layout_for_edge(s, id)
end
-- continue the pipeline
B()
end