z-index fix

This commit is contained in:
2025-10-11 22:38:32 -04:00
parent 89767230d5
commit ea8a0ca17b
3 changed files with 231 additions and 0 deletions

View File

@@ -1799,7 +1799,16 @@ function Element:draw()
)
end
-- Sort children by z-index before drawing
local sortedChildren = {}
for _, child in ipairs(self.children) do
table.insert(sortedChildren, child)
end
table.sort(sortedChildren, function(a, b)
return a.z < b.z
end)
for _, child in ipairs(sortedChildren) do
child:draw()
end
end