Skip to content

Commit

Permalink
ConstrainForHint now ignores values less than 1
Browse files Browse the repository at this point in the history
  • Loading branch information
richardwilkes committed Apr 14, 2019
1 parent 00a87a9 commit 3ba1b81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xmath/geom/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ func (s *Size) GrowToInteger() {
}

// ConstrainForHint ensures this size is no larger than the hint. Hint values
// less than zero are ignored.
// less than one are ignored.
func (s *Size) ConstrainForHint(hint Size) {
if hint.Width >= 0 && s.Width > hint.Width {
if hint.Width >= 1 && s.Width > hint.Width {
s.Width = hint.Width
}
if hint.Height >= 0 && s.Height > hint.Height {
if hint.Height >= 1 && s.Height > hint.Height {
s.Height = hint.Height
}
}
Expand Down

0 comments on commit 3ba1b81

Please sign in to comment.