Merge pull request #7405 from Rydra/upstream/int2immutable

Made int2 class immutable
This commit is contained in:
Matthias Mailänder
2015-03-20 16:03:46 +01:00
11 changed files with 34 additions and 26 deletions

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Widgets
}
var text = WidgetUtils.WrapText(line.Text, chatLogArea.Width - inset - 6, font);
chatpos.Y -= Math.Max(15, font.Measure(text).Y) + 5;
chatpos = chatpos.WithY(chatpos.Y - (Math.Max(15, font.Measure(text).Y) + 5));
if (chatpos.Y < pos.Y)
break;

View File

@@ -30,14 +30,13 @@ namespace OpenRA.Widgets
if (pos.X + widget.ItemSpacing + w.Bounds.Width > widget.Bounds.Width - widget.ScrollbarWidth)
{
/* start a new row */
pos.X = widget.ItemSpacing;
pos.Y = widget.ContentHeight;
pos = new int2(widget.ItemSpacing, widget.ContentHeight);
}
w.Bounds.X += pos.X;
w.Bounds.Y += pos.Y;
pos.X += w.Bounds.Width + widget.ItemSpacing;
pos = pos.WithX(pos.X + w.Bounds.Width + widget.ItemSpacing);
widget.ContentHeight = Math.Max(widget.ContentHeight, pos.Y + widget.ItemSpacing + w.Bounds.Height);
}

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Widgets
if (tooltip != null)
{
if (pos.X + tooltip.Bounds.Right > Game.Renderer.Resolution.Width)
pos.X = Game.Renderer.Resolution.Width - tooltip.Bounds.Right;
pos = pos.WithX(Game.Renderer.Resolution.Width - tooltip.Bounds.Right);
}
return pos;