Fix ContainerBox child insertion

This commit is contained in:
Sasha Koshka 2024-05-07 20:11:58 -04:00
parent 0e2ad5bb4f
commit 6a2dc36140

View File

@ -119,10 +119,14 @@ func (this *containerBox) Insert (child, before tomo.Object) {
beforeBox := assertAnyBox(before.GetBox())
index := indexOf(this.children, tomo.Box(beforeBox))
if index < 0 { return }
if index < 0 {
this.children = append(this.children, tomo.Box(box))
} else {
this.children = insert(this.children, index, tomo.Box(box))
}
box.setParent(this)
this.children = insert(this.children, index, tomo.Box(box))
this.invalidateLayout()
this.invalidateMinimum()
}