Commit 0e75e619 authored by Tebjan Halm's avatar Tebjan Halm
Browse files

Merge pull request #60 from HarkDev/master

Fixed Bound Calculation
parents c1ce332d 02ee6c04
......@@ -47,10 +47,18 @@ namespace Svg
var r = new RectangleF();
foreach(var c in this.Children)
{
if(c is SvgVisualElement)
r = RectangleF.Union(r, ((SvgVisualElement)c).Bounds);
if (c is SvgVisualElement)
{
// First it should check if rectangle is empty or it will return the wrong Bounds.
// This is because when the Rectangle is Empty, the Union method adds as if the first values where X=0, Y=0
if (r.IsEmpty)
r = ((SvgVisualElement)c).Bounds;
else
r = RectangleF.Union(r, ((SvgVisualElement)c).Bounds);
}
}
return r;
return r;
}
}
......@@ -81,4 +89,4 @@ namespace Svg
return newObj;
}
}
}
\ No newline at end of file
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment