Removes spacing between dropdown menu items.
This commit is contained in:
@@ -21,22 +21,25 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public void AdjustChild(Widget w)
|
public void AdjustChild(Widget w)
|
||||||
{
|
{
|
||||||
if (widget.Children.Count == 0)
|
if (widget.Children.Count == 0)
|
||||||
widget.ContentHeight = widget.ItemSpacing;
|
widget.ContentHeight = 2 * widget.TopBottomSpacing - widget.ItemSpacing;
|
||||||
|
|
||||||
w.Bounds.Y = widget.ContentHeight;
|
w.Bounds.Y = widget.ContentHeight - widget.TopBottomSpacing + widget.ItemSpacing;
|
||||||
if (!widget.CollapseHiddenChildren || w.IsVisible())
|
if (!widget.CollapseHiddenChildren || w.IsVisible())
|
||||||
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdjustChildren()
|
public void AdjustChildren()
|
||||||
{
|
{
|
||||||
widget.ContentHeight = widget.ItemSpacing;
|
widget.ContentHeight = widget.TopBottomSpacing;
|
||||||
foreach (var w in widget.Children)
|
foreach (var w in widget.Children)
|
||||||
{
|
{
|
||||||
w.Bounds.Y = widget.ContentHeight;
|
w.Bounds.Y = widget.ContentHeight;
|
||||||
if (!widget.CollapseHiddenChildren || w.IsVisible())
|
if (!widget.CollapseHiddenChildren || w.IsVisible())
|
||||||
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
widget.ContentHeight += w.Bounds.Height + widget.ItemSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The loop above appended an extra widget.ItemSpacing after the last item. Replace it with proper bottom spacing.
|
||||||
|
widget.ContentHeight += widget.TopBottomSpacing - widget.ItemSpacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
readonly Ruleset modRules;
|
readonly Ruleset modRules;
|
||||||
public int ScrollbarWidth = 24;
|
public int ScrollbarWidth = 24;
|
||||||
public int ItemSpacing = 2;
|
public int TopBottomSpacing = 2;
|
||||||
|
public int ItemSpacing = 0;
|
||||||
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
||||||
public string Background = "scrollpanel-bg";
|
public string Background = "scrollpanel-bg";
|
||||||
public string Button = "scrollpanel-button";
|
public string Button = "scrollpanel-button";
|
||||||
|
|||||||
Reference in New Issue
Block a user