Merge pull request #8840 from deniz1a/dropdown-gap
Removes spacing between dropdown menu items.
This commit is contained in:
@@ -24,14 +24,14 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
if (widget.Children.Count == 0)
|
if (widget.Children.Count == 0)
|
||||||
{
|
{
|
||||||
widget.ContentHeight = widget.ItemSpacing;
|
widget.ContentHeight = 2 * widget.TopBottomSpacing;
|
||||||
pos = new int2(widget.ItemSpacing, widget.ItemSpacing);
|
pos = new int2(widget.ItemSpacing, widget.TopBottomSpacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos.X + widget.ItemSpacing + w.Bounds.Width > widget.Bounds.Width - widget.ScrollbarWidth)
|
if (pos.X + w.Bounds.Width + widget.ItemSpacing > widget.Bounds.Width - widget.ScrollbarWidth)
|
||||||
{
|
{
|
||||||
/* start a new row */
|
/* start a new row */
|
||||||
pos = new int2(widget.ItemSpacing, widget.ContentHeight);
|
pos = new int2(widget.ItemSpacing, widget.ContentHeight - widget.TopBottomSpacing + widget.ItemSpacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
w.Bounds.X += pos.X;
|
w.Bounds.X += pos.X;
|
||||||
@@ -39,11 +39,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
pos = pos.WithX(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);
|
widget.ContentHeight = Math.Max(widget.ContentHeight, pos.Y + w.Bounds.Height + widget.TopBottomSpacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AdjustChildren()
|
public void AdjustChildren() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,22 +21,26 @@ 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";
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ ScrollPanel@NEWS_PANEL:
|
|||||||
Width: 400
|
Width: 400
|
||||||
Height: 265
|
Height: 265
|
||||||
Background: panel-black
|
Background: panel-black
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@NEWS_ITEM_TEMPLATE:
|
Container@NEWS_ITEM_TEMPLATE:
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Y: 24
|
Y: 24
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM - 24
|
Height: PARENT_BOTTOM - 24
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@TILEPREVIEW_TEMPLATE:
|
ScrollItem@TILEPREVIEW_TEMPLATE:
|
||||||
@@ -289,6 +290,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
ScrollPanel@LAYERTEMPLATE_LIST:
|
ScrollPanel@LAYERTEMPLATE_LIST:
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@LAYERPREVIEW_TEMPLATE:
|
ScrollItem@LAYERPREVIEW_TEMPLATE:
|
||||||
@@ -320,6 +322,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Y: 24
|
Y: 24
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: PARENT_BOTTOM - 24
|
Height: PARENT_BOTTOM - 24
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@ACTORPREVIEW_TEMPLATE:
|
ScrollItem@ACTORPREVIEW_TEMPLATE:
|
||||||
@@ -389,4 +392,4 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Height: 25
|
Height: 25
|
||||||
Align: Left
|
Align: Left
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Contrast: true
|
Contrast: true
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ Container@CHAT_PANEL:
|
|||||||
Y: PARENT_BOTTOM - HEIGHT - 30
|
Y: PARENT_BOTTOM - HEIGHT - 30
|
||||||
Width: 550
|
Width: 550
|
||||||
Height: 164
|
Height: 164
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Align: Bottom
|
Align: Bottom
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Container@MISSION_OBJECTIVES:
|
|||||||
Y: 50
|
Y: 50
|
||||||
Width: 482
|
Width: 482
|
||||||
Height: 310
|
Height: 310
|
||||||
|
TopBottomSpacing: 15
|
||||||
ItemSpacing: 15
|
ItemSpacing: 15
|
||||||
Children:
|
Children:
|
||||||
Container@OBJECTIVE_TEMPLATE:
|
Container@OBJECTIVE_TEMPLATE:
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ Container@SKIRMISH_STATS:
|
|||||||
Y: 105
|
Y: 105
|
||||||
Width: 482
|
Width: 482
|
||||||
Height: 255
|
Height: 255
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@PLAYER_TEMPLATE:
|
Container@PLAYER_TEMPLATE:
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ Background@INGAME_OBSERVERSTATS_BG:
|
|||||||
Y: 70
|
Y: 70
|
||||||
Width: PARENT_RIGHT-30
|
Width: PARENT_RIGHT-30
|
||||||
Height: PARENT_BOTTOM-35-50
|
Height: PARENT_BOTTOM-35-50
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@TEAM_TEMPLATE:
|
ScrollItem@TEAM_TEMPLATE:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ ScrollPanel@LOBBY_PLAYER_BIN:
|
|||||||
Y: 30
|
Y: 30
|
||||||
Width: 556
|
Width: 556
|
||||||
Height: 219
|
Height: 219
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@TEMPLATE_EDITABLE_PLAYER:
|
Container@TEMPLATE_EDITABLE_PLAYER:
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ Container@SERVER_LOBBY:
|
|||||||
Y: 285
|
Y: 285
|
||||||
Width: PARENT_RIGHT - 30
|
Width: PARENT_RIGHT - 30
|
||||||
Height: PARENT_BOTTOM - 324
|
Height: PARENT_BOTTOM - 324
|
||||||
|
TopBottomSpacing: 2
|
||||||
ItemSpacing: 2
|
ItemSpacing: 2
|
||||||
Children:
|
Children:
|
||||||
Container@CHAT_TEMPLATE:
|
Container@CHAT_TEMPLATE:
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ Container@SETTINGS_PANEL:
|
|||||||
X: 15
|
X: 15
|
||||||
Y: 155
|
Y: 155
|
||||||
Width: 560
|
Width: 560
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Height: 190
|
Height: 190
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE:
|
|||||||
ScrollPanel@NEWS_PANEL:
|
ScrollPanel@NEWS_PANEL:
|
||||||
Width: 370
|
Width: 370
|
||||||
Height: 265
|
Height: 265
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@NEWS_ITEM_TEMPLATE:
|
Container@NEWS_ITEM_TEMPLATE:
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ Container@SKIRMISH_STATS:
|
|||||||
Y: 105
|
Y: 105
|
||||||
Width: 482
|
Width: 482
|
||||||
Height: 265
|
Height: 265
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@PLAYER_TEMPLATE:
|
Container@PLAYER_TEMPLATE:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ScrollPanel@LOBBY_PLAYER_BIN:
|
ScrollPanel@LOBBY_PLAYER_BIN:
|
||||||
X: 20
|
X: 20
|
||||||
Y: 67
|
Y: 67
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Width: 593
|
Width: 593
|
||||||
Height: 235
|
Height: 235
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE:
|
|||||||
ScrollPanel@NEWS_PANEL:
|
ScrollPanel@NEWS_PANEL:
|
||||||
Width: 370
|
Width: 370
|
||||||
Height: 265
|
Height: 265
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@NEWS_ITEM_TEMPLATE:
|
Container@NEWS_ITEM_TEMPLATE:
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Y: 35
|
Y: 35
|
||||||
Width: PARENT_RIGHT-20
|
Width: PARENT_RIGHT-20
|
||||||
Height: PARENT_BOTTOM-45
|
Height: PARENT_BOTTOM-45
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@TILEPREVIEW_TEMPLATE:
|
ScrollItem@TILEPREVIEW_TEMPLATE:
|
||||||
@@ -266,6 +267,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Y: 10
|
Y: 10
|
||||||
Width: PARENT_RIGHT-20
|
Width: PARENT_RIGHT-20
|
||||||
Height: PARENT_BOTTOM-20
|
Height: PARENT_BOTTOM-20
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@LAYERPREVIEW_TEMPLATE:
|
ScrollItem@LAYERPREVIEW_TEMPLATE:
|
||||||
@@ -298,6 +300,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Y: 35
|
Y: 35
|
||||||
Width: PARENT_RIGHT-20
|
Width: PARENT_RIGHT-20
|
||||||
Height: PARENT_BOTTOM-45
|
Height: PARENT_BOTTOM-45
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@ACTORPREVIEW_TEMPLATE:
|
ScrollItem@ACTORPREVIEW_TEMPLATE:
|
||||||
@@ -376,4 +379,4 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Height: 25
|
Height: 25
|
||||||
Align: Left
|
Align: Left
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Contrast: true
|
Contrast: true
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ Container@CHAT_PANEL:
|
|||||||
Y: PARENT_BOTTOM - HEIGHT - 30
|
Y: PARENT_BOTTOM - HEIGHT - 30
|
||||||
Width: 550
|
Width: 550
|
||||||
Height: 164
|
Height: 164
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Align: Bottom
|
Align: Bottom
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ Background@INGAME_DIPLOMACY_BG:
|
|||||||
Y: 67
|
Y: 67
|
||||||
Width: PARENT_RIGHT-40
|
Width: PARENT_RIGHT-40
|
||||||
Height: PARENT_BOTTOM-87-35
|
Height: PARENT_BOTTOM-87-35
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@TEAM_TEMPLATE:
|
ScrollItem@TEAM_TEMPLATE:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Container@MISSION_OBJECTIVES:
|
|||||||
Y: 60
|
Y: 60
|
||||||
Width: 482
|
Width: 482
|
||||||
Height: 310
|
Height: 310
|
||||||
|
TopBottomSpacing: 15
|
||||||
ItemSpacing: 15
|
ItemSpacing: 15
|
||||||
Children:
|
Children:
|
||||||
Container@OBJECTIVE_TEMPLATE:
|
Container@OBJECTIVE_TEMPLATE:
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ Container@SKIRMISH_STATS:
|
|||||||
Y: 105
|
Y: 105
|
||||||
Width: 482
|
Width: 482
|
||||||
Height: 265
|
Height: 265
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@PLAYER_TEMPLATE:
|
Container@PLAYER_TEMPLATE:
|
||||||
|
|||||||
@@ -258,6 +258,7 @@ Background@INGAME_OBSERVERSTATS_BG:
|
|||||||
Y: 70
|
Y: 70
|
||||||
Width: PARENT_RIGHT-50
|
Width: PARENT_RIGHT-50
|
||||||
Height: PARENT_BOTTOM-45-50
|
Height: PARENT_BOTTOM-45-50
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
ScrollItem@TEAM_TEMPLATE:
|
ScrollItem@TEAM_TEMPLATE:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
ScrollPanel@LOBBY_PLAYER_BIN:
|
ScrollPanel@LOBBY_PLAYER_BIN:
|
||||||
X: 20
|
X: 20
|
||||||
Y: 67
|
Y: 67
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Width: 593
|
Width: 593
|
||||||
Height: 235
|
Height: 235
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ Background@SERVER_LOBBY:
|
|||||||
Y: PARENT_BOTTOM - HEIGHT - 52
|
Y: PARENT_BOTTOM - HEIGHT - 52
|
||||||
Width: 818
|
Width: 818
|
||||||
Height: 210
|
Height: 210
|
||||||
|
TopBottomSpacing: 2
|
||||||
ItemSpacing: 2
|
ItemSpacing: 2
|
||||||
Children:
|
Children:
|
||||||
Container@CHAT_TEMPLATE:
|
Container@CHAT_TEMPLATE:
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ Background@SETTINGS_PANEL:
|
|||||||
X: 15
|
X: 15
|
||||||
Y: 155
|
Y: 155
|
||||||
Width: 560
|
Width: 560
|
||||||
|
TopBottomSpacing: 4
|
||||||
ItemSpacing: 4
|
ItemSpacing: 4
|
||||||
Height: 190
|
Height: 190
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE:
|
|||||||
ScrollPanel@NEWS_PANEL:
|
ScrollPanel@NEWS_PANEL:
|
||||||
Width: 370
|
Width: 370
|
||||||
Height: 265
|
Height: 265
|
||||||
|
TopBottomSpacing: 5
|
||||||
ItemSpacing: 5
|
ItemSpacing: 5
|
||||||
Children:
|
Children:
|
||||||
Container@NEWS_ITEM_TEMPLATE:
|
Container@NEWS_ITEM_TEMPLATE:
|
||||||
|
|||||||
Reference in New Issue
Block a user