From 53167788d673f88db5986b1b47449f078519e61f Mon Sep 17 00:00:00 2001 From: faiface Date: Mon, 15 May 2017 01:15:16 +0200 Subject: [PATCH] accept zero target size in Rect.Resized --- geometry.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geometry.go b/geometry.go index fc0f9be..8837300 100644 --- a/geometry.go +++ b/geometry.go @@ -243,10 +243,10 @@ func (r Rect) WithMax(max Vec) Rect { // r.Resized(r.Max, size) // same with the top-right corner // r.Resized(r.Center(), size) // resizes around the center // -// This function does not make sense for sizes of zero area and will panic. Use ResizedMin in the -// case of zero area. +// This function does not make sense for resizing a rectangle of zero area and will panic. Use +// ResizedMin in the case of zero area. func (r Rect) Resized(anchor, size Vec) Rect { - if r.W()*r.H() == 0 || size.X()*size.Y() == 0 { + if r.W()*r.H() == 0 { panic(fmt.Errorf("(%T).Resize: zero area", r)) } fraction := V(size.X()/r.W(), size.Y()/r.H())