Widget refactoring to support listboxes

This commit is contained in:
Paul Chote
2010-07-12 17:41:25 +12:00
parent d740cf9fcd
commit f70ac60135
12 changed files with 25 additions and 38 deletions

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Widgets
if (mi.Event == MouseInputEvent.Down && mi.Button == MouseButton.Left)
{
var container = new Rectangle(DrawPosition().X, DrawPosition().Y, Parent.Bounds.Width, Parent.Bounds.Height);
var container = new Rectangle(RenderOrigin.X, RenderOrigin.Y, Parent.Bounds.Width, Parent.Bounds.Height);
var p = map.Waypoints
.Select((sp, i) => Pair.New(map.ConvertToPreview(sp.Value, container), i))
@@ -64,9 +64,7 @@ namespace OpenRA.Widgets
lastMap = map;
}
var pos = DrawPosition();
var rect = new Rectangle(pos.X, pos.Y, Bounds.Width, Bounds.Height);
var mapRect = map.PreviewBounds( new Rectangle( rect.X, rect.Y, rect.Width, rect.Height ) );
var mapRect = map.PreviewBounds( RenderBounds );
if( mapPreviewDirty )
{
@@ -83,7 +81,7 @@ namespace OpenRA.Widgets
"chrome",
new float2( mapRect.Size ) );
DrawSpawnPoints( map, new Rectangle(pos.X, pos.Y, Parent.Bounds.Width, Parent.Bounds.Height ), world );
DrawSpawnPoints( map, new Rectangle(RenderOrigin.X, RenderOrigin.Y, Parent.Bounds.Width, Parent.Bounds.Height ), world );
}
void DrawSpawnPoints(MapStub map, Rectangle container, World world)