diff --git a/fd/Graph.lua b/fd/Graph.lua index 73a26b4..83f1426 100644 --- a/fd/Graph.lua +++ b/fd/Graph.lua @@ -57,7 +57,7 @@ function Graph.new() if type( node ) == 'string' then self:addNode( node, nil, rx, ry ); elseif type( node ) == 'table' then - self:addNode( node.id, node.name, node.x or rx, node.y or ry ); + self:addNode( node.id, node.name, node.x or rx, node.y or ry, node.anchor ); end end @@ -72,9 +72,9 @@ function Graph.new() -- @param x - The x-coordinate at which to place the new node. -- @param y - The y-coordinate at which to place the new node. -- - function self:addNode( id, name, x, y ) + function self:addNode( id, name, x, y, anchor ) assert( not nodes[id], "Node IDs must be unique." ); - nodes[id] = Node.new( id, name, x, y ); + nodes[id] = Node.new( id, name, x, y, anchor ); return nodes[id]; end diff --git a/fd/Node.lua b/fd/Node.lua index b1ae6e7..8fa751a 100644 --- a/fd/Node.lua +++ b/fd/Node.lua @@ -12,11 +12,10 @@ local DEFAULT_MASS = 0.05; --- -- @param id - A unique id which will be used to reference this node. -- -function Node.new( id, name, x, y ) +function Node.new( id, name, x, y, anchor ) local self = {}; local name = name or id; - local anchor = false; local px, py = x or 0, y or 0; local ax, ay = 0, 0; local vx, vy = 0, 0;