redraw edges when moving nodes around
This commit is contained in:
parent
bd74e26d0b
commit
dae769525f
2
0019-B
2
0019-B
|
@ -1,11 +1,9 @@
|
|||
B = function(preserve_screen_top_of_cursor_node)
|
||||
print('B')
|
||||
-- recompute various aspects based on the current viewport settings
|
||||
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font so update it
|
||||
for _,obj in ipairs(Surface) do
|
||||
if obj.type == 'line' then
|
||||
obj.zdata = {}
|
||||
print('A', #obj.data)
|
||||
for i=1,#obj.data,2 do
|
||||
table.insert(obj.zdata, vx(obj.data[i]))
|
||||
table.insert(obj.zdata, vy(obj.data[i+1]))
|
||||
|
|
1
0028-A
1
0028-A
|
@ -1,5 +1,4 @@
|
|||
A = function(preserve_screen_top_of_cursor_node)
|
||||
print('A')
|
||||
-- translate Nodes to Surface
|
||||
while #Surface > 0 do table.remove(Surface) end
|
||||
for key,node in pairs(Nodes) do
|
||||
|
|
15
0040-A1
15
0040-A1
|
@ -5,13 +5,26 @@ A1 = function(id, preserve_screen_top_of_cursor_node)
|
|||
-- delete previously added shapes for this node:
|
||||
for i=#Surface,1,-1 do
|
||||
local x = Surface[i]
|
||||
if x.id == id then
|
||||
if x.id then print(x.id, x.type)
|
||||
elseif x.keys then
|
||||
print('keys', x.type)
|
||||
for _,k in ipairs(x.keys) do
|
||||
print('', k)
|
||||
end
|
||||
end
|
||||
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, preserve_screen_top_of_cursor_node)
|
||||
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(preserve_screen_top_of_cursor_node)
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
compute_layout_for_edge = function(s, e)
|
||||
local cs = centroid(Nodes[s])
|
||||
local ce = centroid(Nodes[e])
|
||||
local s = intersect_with_centroid(Nodes[s], ce.sx,ce.sy)
|
||||
local e = intersect_with_centroid(Nodes[e], s.sx,s.sy)
|
||||
table.insert(Surface, {type='line', r=0,g=0,b=0, data={s.sx,s.sy, e.sx,e.sy}})
|
||||
end
|
||||
local s2 = intersect_with_centroid(Nodes[s], ce.sx,ce.sy)
|
||||
local e2 = intersect_with_centroid(Nodes[e], s2.sx,s2.sy)
|
||||
table.insert(Surface, {type='line', r=0,g=0,b=0, data={s2.sx,s2.sy, e2.sx,e2.sy}, keys={s,e}})
|
||||
end
|
Loading…
Reference in New Issue