diff --git a/pixelgl/window.go b/pixelgl/window.go index 998029517a213870d5aac0db725f1e1bfcb036a9..f844dbca92d494ea4b7a0bb72d5455cbf4e62319 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -145,11 +145,15 @@ func (w *Window) Destroy() { // Update swaps buffers and polls events. func (w *Window) Update() { mainthread.Call(func() { - wi, hi := w.window.GetSize() - w.bounds = w.bounds.ResizedMin(pixel.V(float64(wi), float64(hi))) + _, _, oldW, oldH := intBounds(w.bounds) + newW, newH := w.window.GetSize() + w.bounds = w.bounds.ResizedMin(w.bounds.Size() + pixel.V( + float64(newW-oldW), + float64(newH-oldH), + )) }) - w.canvas.SetBounds(w.Bounds()) + w.canvas.SetBounds(w.bounds) mainthread.Call(func() { w.begin()