Skip to content

Commit

Permalink
Fix issue where dialog shadows may not resize
Browse files Browse the repository at this point in the history
The inner size was not updated when our content forced it to.
We cannot override it or it won't shrink again, so this fixes the calculation for shadow size.

Fixes #1370
  • Loading branch information
andydotxyz committed Nov 27, 2020
1 parent 786799f commit 4acd703
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,7 @@ More detailed release notes can be found on the [releases page](https://github.c
* [fyne-cli] Android: allow to specify an inline password for the keystore
* Fixed Card widget MinSize (#1581)
* Fix missing release tag to enable BuildRelease in Settings.BuildType()
* Dialog shadow does not resize after Refresh (#1370)


## 1.4.1 - 20 November 2020
Expand Down
Binary file modified dialog/testdata/color/dialog_expanded_theme_dark.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_expanded_theme_light.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions widget/popup.go
Expand Up @@ -232,7 +232,9 @@ type modalPopUpRenderer struct {

func (r *modalPopUpRenderer) Layout(canvasSize fyne.Size) {
padding := r.padding()
requestedSize := r.popUp.innerSize.Subtract(padding)
innerSize := r.popUp.innerSize.Max(r.popUp.Content.MinSize().Add(padding))

requestedSize := innerSize.Subtract(padding)
size := r.popUp.Content.MinSize().Max(requestedSize)
size = size.Min(canvasSize.Subtract(padding))
pos := fyne.NewPos((canvasSize.Width-size.Width)/2, (canvasSize.Height-size.Height)/2)
Expand All @@ -242,7 +244,7 @@ func (r *modalPopUpRenderer) Layout(canvasSize fyne.Size) {
innerPos := pos.Subtract(r.offset())
r.bg.Move(innerPos)
r.bg.Resize(size.Add(padding))
r.LayoutShadow(r.popUp.innerSize, innerPos)
r.LayoutShadow(innerSize, innerPos)
}

func (r *modalPopUpRenderer) MinSize() fyne.Size {
Expand Down

0 comments on commit 4acd703

Please sign in to comment.