393
edits
No edit summary |
No edit summary |
||
Line 57: | Line 57: | ||
local levels = {} | local levels = {} | ||
local function findLevel(node, currentLevel) | local function findLevel(node, currentLevel) | ||
if not levels[node.name] then | if not levels[node.name] then | ||
levels[node.name] = currentLevel | levels[node.name] = currentLevel | ||
Line 94: | Line 93: | ||
-- Constants for layout | -- Constants for layout | ||
local baseX = | local baseX = 400 -- Adjust starting X position | ||
local baseY = 50 -- | local baseY = 50 -- Starting Y position | ||
local verticalSpacing = 200 -- Distance between levels (Y-axis) | local verticalSpacing = 200 -- Distance between levels (Y-axis) | ||
local horizontalSpacing = 300 -- Distance between nodes at the same level (X-axis) | local horizontalSpacing = 300 -- Distance between nodes at the same level (X-axis) | ||
Line 126: | Line 125: | ||
-- Position each node dynamically | -- Position each node dynamically | ||
for | for i, node in ipairs(skillNodes) do | ||
local level = nodeLevels[node.name] | local level = nodeLevels[node.name] | ||
local nodesAtThisLevel = nodesPerLevel[level] | local nodesAtThisLevel = nodesPerLevel[level] | ||
local indexInLevel = | local indexInLevel = i | ||
-- Calculate X and Y positions for this node | -- Calculate X and Y positions for this node | ||
Line 141: | Line 140: | ||
local nodeDiv = html:tag('div'):css({ | local nodeDiv = html:tag('div'):css({ | ||
['position'] = 'absolute', | ['position'] = 'absolute', | ||
['width'] = ' | ['width'] = '150px', | ||
['height'] = '100px', | ['height'] = '100px', | ||
['top'] = yPos .. 'px', | ['top'] = yPos .. 'px', | ||
Line 155: | Line 154: | ||
['font-weight'] = '700', | ['font-weight'] = '700', | ||
}):done() | }):done() | ||
-- Append nodeDiv to HTML | -- Append nodeDiv to HTML |
edits