Skip to content

Commit

Permalink
avoid unnecessary refreshes
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Oct 19, 2023
1 parent eae759c commit 66bc8a1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions widget/hyperlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ func (hl *Hyperlink) FocusLost() {

// MouseIn is a hook that is called if the mouse pointer enters the element.
func (hl *Hyperlink) MouseIn(e *desktop.MouseEvent) {
hl.hovered = hl.isPosOverText(e.Position)
hl.BaseWidget.Refresh()
hl.MouseMoved(e)
}

// MouseMoved is a hook that is called if the mouse pointer moved over the element.
Expand All @@ -103,8 +102,11 @@ func (hl *Hyperlink) MouseMoved(e *desktop.MouseEvent) {

// MouseOut is a hook that is called if the mouse pointer leaves the element.
func (hl *Hyperlink) MouseOut() {
changed := hl.hovered
hl.hovered = false
hl.BaseWidget.Refresh()
if changed {
hl.BaseWidget.Refresh()
}
}

func (hl *Hyperlink) focusWidth() float32 {
Expand Down

0 comments on commit 66bc8a1

Please sign in to comment.