Container removeChild fix

- fixed containers removeChild call
- fixed using remove on flexbox childrens
This commit is contained in:
Robert Jelic
2024-03-20 00:51:12 +01:00
parent 4fefe5734c
commit ca2fd64302
2 changed files with 20 additions and 1 deletions

View File

@@ -93,7 +93,7 @@ return function(name, basalt)
return
end
for i, v in ipairs(children) do
if v.element == element then
if v.element:getName() == element:getName() then
table.remove(children, i)
return true
end

View File

@@ -408,6 +408,25 @@ return function(name, basalt)
end
end,
removeChild = function(self, child)
if (type(child)=="string") then
child = getChild(element:getName())
end
if (child==nil) then
return
end
base.removeChild(self, child)
for k, v in pairs(children) do
if v:getName() == child:getName() then
table.remove(children, k)
break
end
end
updateLayout = true
self:updateDraw()
return self
end,
draw = function(self)
base.draw(self)
self:addDraw("flexboxDraw", function()