diff --git a/elements/basic/label.go b/elements/basic/label.go index 566be37..7e5d9e8 100644 --- a/elements/basic/label.go +++ b/elements/basic/label.go @@ -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) diff --git a/examples/checkbox/main.go b/examples/checkbox/main.go index cf46691..aac46b2 100644 --- a/examples/checkbox/main.go +++ b/examples/checkbox/main.go @@ -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)