Sort of fixed a flexible height bug

This commit is contained in:
2023-03-10 00:10:26 -05:00
parent 1c28613981
commit 8658ecd879
2 changed files with 8 additions and 8 deletions

View File

@@ -71,7 +71,7 @@ func (element *Container) Adopt (child elements.Element, expand bool) {
element.core.DamageAll()
})
if child0, ok := child.(elements.Flexible); ok {
child0.OnFlexibleHeightChange(element.updateMinimumSize)
child0.OnFlexibleHeightChange(element.notifyFlexibleChange)
}
if child0, ok := child.(elements.Focusable); ok {
child0.OnFocusRequest (func () (granted bool) {
@@ -323,14 +323,15 @@ func (element *Container) updateMinimumSize () {
padding := element.theme.Padding(theme.PatternBackground)
width, height := element.layout.MinimumSize (
element.children, margin, padding)
if element.flexible {
height = element.layout.FlexibleHeightFor (
element.children, margin,
padding, width)
}
element.core.SetMinimumSize(width, height)
}
func (element *Container) notifyFlexibleChange () {
if element.onFlexibleHeightChange != nil {
element.onFlexibleHeightChange()
}
}
func (element *Container) doLayout () {
margin := element.theme.Margin(theme.PatternBackground)
padding := element.theme.Padding(theme.PatternBackground)