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

@@ -65,7 +65,7 @@ namespace OpenRA.Widgets
return true;
}
public override Rectangle RenderBounds
public override Rectangle EventBounds
{
get { return new Rectangle((int)radarOrigin.X + 9, (int)(radarOrigin.Y + (192 - radarMinimapHeight) / 2),
192, (int)radarMinimapHeight);}

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Widgets
clock = new Animation("clock");
}
public override Rectangle RenderBounds
public override Rectangle EventBounds
{
get { return buttons.Any() ? buttons.Select(b => b.First).Aggregate(Rectangle.Union) : Bounds; }
}

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);
}