Label conforms to new API

This commit is contained in:
Sasha Koshka 2023-01-16 00:36:23 -05:00
parent 21a1a35a26
commit 410c65c072

View File

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