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:
parent
66f061b1fc
commit
beb254a9ac
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user