scroll maplist to the top when changing filter

This commit is contained in:
Chris Forbes
2011-10-08 17:36:48 +13:00
parent f966c08fed
commit cf46a7ed5f
2 changed files with 6 additions and 0 deletions

View File

@@ -125,6 +125,11 @@ namespace OpenRA.Widgets
ListOffset = Math.Min(0,Bounds.Height - ContentHeight);
}
public void ScrollToTop()
{
ListOffset = 0;
}
public override void Tick ()
{
if (UpPressed) Scroll(1);

View File

@@ -80,6 +80,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
void EnumerateMaps()
{
scrollpanel.RemoveChildren();
(scrollpanel as ScrollPanelWidget).ScrollToTop();
var maps = Game.modData.AvailableMaps
.Where(kv => kv.Value.Selectable)