From beb254a9ac05d8a339d637d54b1d967b2404662c Mon Sep 17 00:00:00 2001 From: Adam Bozanich Date: Sun, 26 Sep 2021 09:38:46 -0700 Subject: [PATCH] viewport: truncate size to area avaiable in parent (#153) * viewport: truncate size to area avaiable in parent * boxlayout: handle widget removal --- views/view.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/views/view.go b/views/view.go index aac7db52..993b3a36 100644 --- a/views/view.go +++ b/views/view.go @@ -265,18 +265,15 @@ func (v *ViewPort) Resize(x, y, width, height int) { if y >= 0 && y < py { v.physy = y } - if width < 0 { + if width < 0 || width > px-x { width = px - x } - if height < 0 { + if height < 0 || height > py-y { height = py - y } - if width <= x+px { - v.width = width - } - if height <= y+py { - v.height = height - } + + v.width = width + v.height = height } // SetView is called during setup, to provide the parent View.