Skip to content

Commit

Permalink
viewport: truncate size to area avaiable in parent
Browse files Browse the repository at this point in the history
  • Loading branch information
boz committed Jul 18, 2017
1 parent 01ac1e4 commit cc56663
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions views/view.go
Original file line number Diff line number Diff line change
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 cc56663

Please sign in to comment.