diff --git a/label.go b/label.go index cf18910..86a9f1d 100644 --- a/label.go +++ b/label.go @@ -20,6 +20,7 @@ type Label struct { // Configurable fields for the constructor. Text string TextVariable *string + IntVariable *int Font render.Text width int32 @@ -32,6 +33,7 @@ func NewLabel(c Label) *Label { w := &Label{ Text: c.Text, TextVariable: c.TextVariable, + IntVariable: c.IntVariable, Font: DefaultFont, } if !c.Font.IsZero() { @@ -49,6 +51,9 @@ func (w *Label) text() render.Text { if w.TextVariable != nil { w.Font.Text = *w.TextVariable return w.Font + } else if w.IntVariable != nil { + w.Font.Text = fmt.Sprintf("%d", *w.IntVariable) + return w.Font } w.Font.Text = w.Text return w.Font diff --git a/supervisor.go b/supervisor.go index 8c69a73..ac78a51 100644 --- a/supervisor.go +++ b/supervisor.go @@ -173,7 +173,7 @@ func (s *Supervisor) Hovering(cursor render.Point) (hovering, outside []WidgetSl } ) - if XY.X >= P.X && XY.X <= P2.X && XY.Y >= P.Y && XY.Y <= P2.Y { + if XY.X >= P.X && XY.X < P2.X && XY.Y >= P.Y && XY.Y < P2.Y { // Cursor intersects the widget. hovering = append(hovering, child) } else {