From 939a76923d74cc250263954afef5a4ed82977896 Mon Sep 17 00:00:00 2001 From: faiface Date: Thu, 13 Apr 2017 15:26:48 +0200 Subject: [PATCH] simplify code in Rect.Resized --- geometry.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geometry.go b/geometry.go index 3244c63..e494712 100644 --- a/geometry.go +++ b/geometry.go @@ -249,7 +249,7 @@ func (r Rect) Resized(anchor, size Vec) Rect { if r.W()*r.H() == 0 || size.X()*size.Y() == 0 { panic(fmt.Errorf("(%T).Resize: zero area", r)) } - fraction := size.ScaledXY(V(1/r.W(), 1/r.H())) + fraction := V(size.X()/r.W(), size.Y()/r.H()) return Rect{ Min: anchor + (r.Min - anchor).ScaledXY(fraction), Max: anchor + (r.Max - anchor).ScaledXY(fraction),