Skip to content

Commit

Permalink
Copy the overlay resize code from GLFW into Gomobile
Browse files Browse the repository at this point in the history
Fixed #1334
  • Loading branch information
andydotxyz committed Oct 13, 2020
1 parent 26427e2 commit a3333e5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/driver/gomobile/canvas.go
Expand Up @@ -121,6 +121,17 @@ func (c *mobileCanvas) sizeContent(size fyne.Size) {
topLeft := offset.Add(fyne.NewPos(devicePadTopLeft.Width, devicePadTopLeft.Height))

c.size = size
for _, overlay := range c.overlays.List() {
if p, ok := overlay.(*widget.PopUp); ok {
// TODO: remove this when #707 is being addressed.
// “Notifies” the PopUp of the canvas size change.
size := p.Content.Size().Add(fyne.NewSize(theme.Padding()*2, theme.Padding()*2)).Min(innerSize)
p.Resize(size)
} else {
overlay.Resize(innerSize)
overlay.Move(topLeft)
}
}
if c.padded {
c.content.Resize(innerSize.Subtract(fyne.NewSize(theme.Padding()*2, theme.Padding()*2)))
c.content.Move(topLeft.Add(fyne.NewPos(theme.Padding(), theme.Padding())))
Expand Down

0 comments on commit a3333e5

Please sign in to comment.