Skip to content

Commit

Permalink
Make sure that Resize call with a canvas Scale() == 1 express its pre…
Browse files Browse the repository at this point in the history
…cise size.
  • Loading branch information
Cedric BAIL committed Dec 2, 2022
1 parent f98e120 commit 475eab4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/driver/glfw/canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ func (c *glCanvas) PixelCoordinateForPosition(pos fyne.Position) (int, int) {
}

func (c *glCanvas) Resize(size fyne.Size) {
pixelsSize := fyne.NewSize(float32(math.Ceil(float64(size.Width))), float32(math.Ceil(float64(size.Height))))
c.Lock()
c.size = size
c.size = pixelsSize
c.Unlock()

for _, overlay := range c.Overlays().List() {
Expand All @@ -115,17 +116,17 @@ func (c *glCanvas) Resize(size fyne.Size) {
// “Notifies” the PopUp of the canvas size change.
p.Refresh()
} else {
overlay.Resize(size)
overlay.Resize(pixelsSize)
}
}

c.RLock()
c.content.Resize(c.contentSize(size))
c.content.Resize(c.contentSize(pixelsSize))
c.content.Move(c.contentPos())

if c.menu != nil {
c.menu.Refresh()
c.menu.Resize(fyne.NewSize(size.Width, c.menu.MinSize().Height))
c.menu.Resize(fyne.NewSize(pixelsSize.Width, c.menu.MinSize().Height))
}
c.RUnlock()
}
Expand Down

0 comments on commit 475eab4

Please sign in to comment.