mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-01 22:26:27 -05:00
fixed onHover bug in d2ui.Label (#991)
Co-authored-by: M. Sz <mszeptuch@protonmail.com>
This commit is contained in:
parent
fbfea917cb
commit
5409dc4ef2
@ -46,6 +46,10 @@ func (ui *UIManager) NewLabel(fontPath, palettePath string) *Label {
|
||||
|
||||
result.bindManager(ui)
|
||||
|
||||
result.SetVisible(false)
|
||||
|
||||
ui.addWidget(result)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@ -96,11 +100,6 @@ func (v *Label) Render(target d2interface.Surface) {
|
||||
target.Pop()
|
||||
}
|
||||
|
||||
// GetSize returns the size of the label
|
||||
func (v *Label) GetSize() (width, height int) {
|
||||
return v.font.GetTextMetrics(v.text)
|
||||
}
|
||||
|
||||
// GetTextMetrics returns the width and height of the enclosing rectangle in Pixels.
|
||||
func (v *Label) GetTextMetrics(text string) (width, height int) {
|
||||
return v.font.GetTextMetrics(text)
|
||||
@ -109,6 +108,7 @@ func (v *Label) GetTextMetrics(text string) (width, height int) {
|
||||
// SetText sets the label's text
|
||||
func (v *Label) SetText(newText string) {
|
||||
v.text = v.processColorTokens(newText)
|
||||
v.BaseWidget.width, v.BaseWidget.height = v.font.GetTextMetrics(v.text)
|
||||
}
|
||||
|
||||
// GetText returns label text
|
||||
|
Loading…
Reference in New Issue
Block a user