Skip to content

Commit

Permalink
fix: Make gradient resizing refresh and not use cached textures
Browse files Browse the repository at this point in the history
Avoid using cached textures for gradients, by refreshing the object on
resize.

Fixes #4608.
  • Loading branch information
adamantike committed Mar 5, 2024
1 parent 4f9d61b commit b5fd9fb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions canvas/gradient.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ func (g *LinearGradient) Move(pos fyne.Position) {
repaint(g)
}

func (g *LinearGradient) Resize(size fyne.Size) {
if size == g.Size() {
return
}
g.baseObject.Resize(size)

g.Refresh()
}

// Refresh causes this gradient to be redrawn with its configured state.
func (g *LinearGradient) Refresh() {
Refresh(g)
Expand Down Expand Up @@ -136,6 +145,15 @@ func (g *RadialGradient) Move(pos fyne.Position) {
repaint(g)
}

func (g *RadialGradient) Resize(size fyne.Size) {
if size == g.Size() {
return
}
g.baseObject.Resize(size)

g.Refresh()
}

// Refresh causes this gradient to be redrawn with its configured state.
func (g *RadialGradient) Refresh() {
Refresh(g)
Expand Down

0 comments on commit b5fd9fb

Please sign in to comment.