fix window resizing consistency

This commit is contained in:
faiface 2017-03-14 18:31:44 +01:00
parent c81dedd9a1
commit cb3276493d
1 changed files with 7 additions and 3 deletions

View File

@ -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()