Skip to content

Commit

Permalink
viewport: truncate size to area avaiable in parent (#153)
Browse files Browse the repository at this point in the history
* viewport: truncate size to area avaiable in parent

* boxlayout: handle widget removal
  • Loading branch information
boz committed Sep 26, 2021
1 parent 66f061b commit beb254a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions views/view.go
Expand Up @@ -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.
Expand Down

0 comments on commit beb254a

Please sign in to comment.