remove flex positioning requirement for resizing

This commit is contained in:
2025-09-17 12:13:35 -04:00
parent 45deddbad5
commit 35b111893d
3 changed files with 11 additions and 21 deletions

View File

@@ -893,20 +893,16 @@ function Element:resize(newGameWidth, newGameHeight)
local ratioW = newGameWidth / prevW
local ratioH = newGameHeight / prevH
-- Update element size
if self.positioning ~= Positioning.ABSOLUTE then
self.width = self.width * ratioW
self.height = self.height * ratioH
self.x = self.x * ratioW
self.y = self.y * ratioH
end
self.width = self.width * ratioW
self.height = self.height * ratioH
self.x = self.x * ratioW
self.y = self.y * ratioH
-- Update children positions and sizes
for _, child in ipairs(self.children) do
child:resize(ratioW, ratioH)
end
-- Re-layout children after resizing (only for non-absolute containers)
if self.positioning ~= Positioning.ABSOLUTE then
self:layoutChildren()
end
self:layoutChildren()
self.prevGameSize.width = newGameWidth
self.prevGameSize.height = newGameHeight
end