From 7a0f22382979d7f8b205280aab3653b872f94839 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Mon, 15 Feb 2016 14:56:43 +0100 Subject: [PATCH] dont start bound computation with an empty rect or bounds will always start at (0,0) --- src/Rectangles.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Rectangles.cs b/src/Rectangles.cs index c507b2ba..5168f3db 100644 --- a/src/Rectangles.cs +++ b/src/Rectangles.cs @@ -171,11 +171,15 @@ namespace Crow Rectangle _bounds; bool boundsUpToDate = true; public Rectangle Bounds { - get { + get { if (!boundsUpToDate) { - _bounds = Rectangle.Empty; - foreach (Rectangle rInList in list) - _bounds += rInList; + if (list.Count > 0) { + _bounds = list [0]; + for (int i = 1; i < list.Count; i++) { + _bounds += list [i]; + } + } else + _bounds = Rectangle.Empty; boundsUpToDate = true; } return _bounds; -- 2.47.3