Label conforms to new API

This commit is contained in:
Sasha Koshka 2023-01-16 00:36:23 -05:00
parent 21a1a35a26
commit 410c65c072
1 changed files with 4 additions and 8 deletions

View File

@ -28,17 +28,13 @@ func NewLabel (text string, wrap bool) (element *Label) {
return
}
// Handle handles and event.
func (element *Label) Handle (event tomo.Event) {
func (element *Label) Resize (width, height int) {
switch event.(type) {
case tomo.EventResize:
resizeEvent := event.(tomo.EventResize)
element.core.AllocateCanvas (
resizeEvent.Width,
resizeEvent.Height)
element.core.AllocateCanvas(width, height)
if element.wrap {
element.drawer.SetMaxWidth (resizeEvent.Width)
element.drawer.SetMaxHeight(resizeEvent.Height)
element.drawer.SetMaxWidth(width)
element.drawer.SetMaxHeight(height)
}
element.draw()
}