From 4994716cf7c0297f8e16b892233d0b826c6e34ef Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 25 Nov 2017 16:47:02 +0000 Subject: [PATCH] Ignore empty children when aggregating EventBounds. --- OpenRA.Game/Widgets/Widget.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 1c6b082e2f..4af17fed8f 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -284,8 +284,15 @@ namespace OpenRA.Widgets // PERF: Avoid LINQ. var bounds = EventBounds; foreach (var child in Children) + { if (child.IsVisible()) - bounds = Rectangle.Union(bounds, child.GetEventBounds()); + { + var childBounds = child.GetEventBounds(); + if (childBounds != Rectangle.Empty) + bounds = Rectangle.Union(bounds, childBounds); + } + } + return bounds; }