atomize-element-interface #3

Merged
sashakoshka merged 10 commits from atomize-element-interface into main 2023-01-17 19:33:23 +00:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 7398f146ba - Show all commits

View File

@ -300,7 +300,6 @@ func (element *Container) HandleSelection (direction tomo.SelectionDirection) (o
return false
}
// FIXME: fix this!
func (element *Container) MinimumHeightFor (width int) (height int) {
return element.layout.MinimumHeightFor(element.children, width)
}

View File

@ -106,14 +106,18 @@ func (layout Vertical) MinimumSize (
// specified elements at the given width, taking into account flexible elements.
func (layout Vertical) MinimumHeightFor (
entries []tomo.LayoutEntry,
squeeze int,
width int,
) (
height int,
) {
if layout.Pad {
width -= theme.Padding() * 2
}
for index, entry := range entries {
child, flexible := entry.Element.(tomo.Flexible)
if flexible {
height += child.MinimumHeightFor(squeeze)
height += child.MinimumHeightFor(width)
} else {
_, entryHeight := entry.MinimumSize()
height += entryHeight