make maximum and minimum rows configurable

This commit is contained in:
Matthias Mailänder
2015-02-08 10:13:28 +01:00
parent 3be3700722
commit b0f986887c
3 changed files with 9 additions and 3 deletions

View File

@@ -88,8 +88,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
Action<int, int> updateBackground = (_, icons) =>
{
// Minimum of four rows to make space for the production buttons.
var rows = Math.Max(4, (icons + palette.Columns - 1) / palette.Columns);
var rows = Math.Max(palette.MinimumRows, (icons + palette.Columns - 1) / palette.Columns);
rows = Math.Min(rows, palette.MaximumRows);
if (background != null)
{
@@ -189,7 +189,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
// Check if icon heights exceed y resolution
var maxItemsHeight = screenHeight - sidebarProductionHeight;
productionPalette.MaxIconRowOffset = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
var maxIconRowOffest = (maxItemsHeight / productionPalette.IconSize.Y) - 1;
productionPalette.MaxIconRowOffset = Math.Min(maxIconRowOffest, productionPalette.MaximumRows);
}
}
}