mirror of
https://github.com/rm-code/Graphoon.git
synced 2024-11-16 18:24:22 +00:00
Use upvalues
This commit is contained in:
parent
65d78b3ca9
commit
638d72ae20
@ -36,14 +36,10 @@ function Graph.new()
|
|||||||
---
|
---
|
||||||
-- Updates the boundaries of the graph.
|
-- Updates the boundaries of the graph.
|
||||||
-- This represents the rectangular area in which all nodes are contained.
|
-- This represents the rectangular area in which all nodes are contained.
|
||||||
-- @param minX - The current minimum x position.
|
|
||||||
-- @param maxX - The current maximum y position.
|
|
||||||
-- @param minY - The current minimum x position.
|
|
||||||
-- @param maxY - The current maximum y position.
|
|
||||||
-- @param nx - The new x position to check.
|
-- @param nx - The new x position to check.
|
||||||
-- @param ny - The new y position to check.
|
-- @param ny - The new y position to check.
|
||||||
--
|
--
|
||||||
local function updateBoundaries( minX, maxX, minY, maxY, nx, ny )
|
local function updateBoundaries( nx, ny )
|
||||||
return math.min( minX or nx, nx ), math.max( maxX or nx, nx ), math.min( minY or ny, ny ), math.max( maxY or ny, ny );
|
return math.min( minX or nx, nx ), math.max( maxX or nx, nx ), math.min( minY or ny, ny ), math.max( maxY or ny, ny );
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -158,7 +154,7 @@ function Graph.new()
|
|||||||
nodeCallback( nodeA );
|
nodeCallback( nodeA );
|
||||||
end
|
end
|
||||||
|
|
||||||
minX, maxX, minY, maxY = updateBoundaries( minX, maxX, minY, maxY, nodeA:getPosition() );
|
minX, maxX, minY, maxY = updateBoundaries( nodeA:getPosition() );
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user