From 66bc8a1ffb9ef420adf7564b3589bcd2d61aaada Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Wed, 18 Oct 2023 20:20:10 -0700 Subject: [PATCH] avoid unnecessary refreshes --- widget/hyperlink.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/widget/hyperlink.go b/widget/hyperlink.go index 2301bb7428..03b959011b 100644 --- a/widget/hyperlink.go +++ b/widget/hyperlink.go @@ -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. @@ -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 {