1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-24 13:48:51 +08:00

viewport: truncate size to area avaiable in parent (#153)

* viewport: truncate size to area avaiable in parent

* boxlayout: handle widget removal
This commit is contained in:
Adam Bozanich 2021-09-26 09:38:46 -07:00 committed by GitHub
parent 66f061b1fc
commit beb254a9ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.