Remove blatant abuse of RenderBounds

This commit is contained in:
Paul Chote
2010-07-20 23:22:09 +12:00
parent 0d489e638e
commit 46d502e053
3 changed files with 6 additions and 4 deletions

View File

@@ -129,10 +129,12 @@ namespace OpenRA.Widgets
Game.CreateObject<IWidgetDelegate>(d);
}
public virtual Rectangle EventBounds { get { return RenderBounds; } }
public bool HitTest(int2 xy)
{
if (!IsVisible()) return false;
if (RenderBounds.Contains(xy.ToPoint()) && !ClickThrough) return true;
if (EventBounds.Contains(xy.ToPoint()) && !ClickThrough) return true;
return Children.Any(c => c.HitTest(xy));
}
@@ -142,7 +144,7 @@ namespace OpenRA.Widgets
return Children
.Where(c => c.IsVisible())
.Select(c => c.GetEventBounds())
.Aggregate(RenderBounds, Rectangle.Union);
.Aggregate(EventBounds, Rectangle.Union);
}