update player list in lobby gracefully for better user experience
This commit is contained in:
@@ -41,6 +41,11 @@ namespace OpenRA.Widgets
|
||||
|
||||
widget.ContentHeight = Math.Max(widget.ContentHeight, pos.Y + widget.ItemSpacing + w.Bounds.Height);
|
||||
}
|
||||
|
||||
public void AdjustChildren()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,16 @@ namespace OpenRA.Widgets
|
||||
w.Bounds.Y += widget.ContentHeight;
|
||||
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
||||
}
|
||||
|
||||
|
||||
public void AdjustChildren()
|
||||
{
|
||||
widget.ContentHeight = widget.ItemSpacing;
|
||||
foreach (var w in widget.Children)
|
||||
{
|
||||
w.Bounds.Y = widget.ContentHeight;
|
||||
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
public interface ILayout { void AdjustChild(Widget w); }
|
||||
public interface ILayout { void AdjustChild(Widget w); void AdjustChildren(); }
|
||||
|
||||
public class ScrollPanelWidget : Widget
|
||||
{
|
||||
@@ -95,6 +95,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
Game.Renderer.EnableScissor(backgroundRect.X + 1, backgroundRect.Y + 1, backgroundRect.Width - 2, backgroundRect.Height - 2);
|
||||
|
||||
Layout.AdjustChildren();
|
||||
|
||||
foreach (var child in Children)
|
||||
child.DrawOuter();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user