Skip to content

Commit

Permalink
Merge pull request #4693 from adamantike/fix/expire-gradient-cache-wh…
Browse files Browse the repository at this point in the history
…en-size-changes

fix: Make gradient resizing refresh and not use cached textures
  • Loading branch information
dweymouth committed Mar 19, 2024
2 parents 0775df9 + 9934705 commit cb5de39
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions canvas/gradient.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ func (g *LinearGradient) Move(pos fyne.Position) {
repaint(g)
}

// Resize resizes the gradient to a new size.
func (g *LinearGradient) Resize(size fyne.Size) {
if size == g.Size() {
return
}
g.baseObject.Resize(size)

// refresh needed to invalidate cached textures
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 +147,17 @@ func (g *RadialGradient) Move(pos fyne.Position) {
repaint(g)
}

// Resize resizes the gradient to a new size.
func (g *RadialGradient) Resize(size fyne.Size) {
if size == g.Size() {
return
}
g.baseObject.Resize(size)

// refresh needed to invalidate cached textures
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 cb5de39

Please sign in to comment.