Label.EmCollapse actually works now

This commit is contained in:
Sasha Koshka 2023-03-17 01:00:11 -04:00
parent b189518c92
commit 4c6e01203c
2 changed files with 8 additions and 6 deletions

View File

@ -181,15 +181,15 @@ func (element *Label) updateMinimumSize () {
}
if element.forcedColumns > 0 {
width = int (
width =
element.drawer.Em().
Mul(fixed.I(element.forcedColumns)))
Mul(fixed.I(element.forcedColumns)).Floor()
}
if element.forcedRows > 0 {
height = int (
height =
element.drawer.LineHeight().
Mul(fixed.I(element.forcedRows)))
Mul(fixed.I(element.forcedRows)).Floor()
}
element.core.SetMinimumSize(width, height)

View File

@ -18,10 +18,12 @@ func run () {
container := containers.NewContainer(basicLayouts.Vertical { true, true })
window.Adopt(container)
container.Adopt (basicElements.NewLabel (
introText := basicElements.NewLabel (
"We advise you to not read thPlease listen to me. I am " +
"trapped inside the example code. This is the only way for " +
"me to communicate.", true), true)
"me to communicate.", true)
introText.EmCollapse(0, 5)
container.Adopt(introText, true)
container.Adopt(basicElements.NewSpacer(true), false)
container.Adopt(basicElements.NewCheckbox("Oh god", false), false)
container.Adopt(basicElements.NewCheckbox("Can you hear them", true), false)