Added a margin so the scrollbar doesn't overlap the entity's label in the context menu. (#3426)
This commit is contained in:
committed by
GitHub
parent
1696c432a1
commit
f96839cb4c
@@ -66,7 +66,6 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
AddChild(
|
AddChild(
|
||||||
new HBoxContainer
|
new HBoxContainer
|
||||||
{
|
{
|
||||||
SeparationOverride = 6,
|
|
||||||
Children =
|
Children =
|
||||||
{
|
{
|
||||||
new LayoutContainer
|
new LayoutContainer
|
||||||
@@ -77,7 +76,7 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
{
|
{
|
||||||
Text = Loc.GetString(UserInterfaceManager.DebugMonitors.Visible ? $"{ContextEntity.Name} ({ContextEntity.Uid})" : ContextEntity.Name)
|
Text = Loc.GetString(UserInterfaceManager.DebugMonitors.Visible ? $"{ContextEntity.Name} ({ContextEntity.Uid})" : ContextEntity.Name)
|
||||||
}
|
}
|
||||||
}
|
}, Margin = new Thickness(0,0,10,0)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -151,9 +150,9 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
Texture = IoCManager.Resolve<IResourceCache>().GetTexture("/Textures/Interface/VerbIcons/group.svg.96dpi.png"),
|
Texture = IoCManager.Resolve<IResourceCache>().GetTexture("/Textures/Interface/VerbIcons/group.svg.96dpi.png"),
|
||||||
Stretch = TextureRect.StretchMode.KeepCentered,
|
Stretch = TextureRect.StretchMode.KeepCentered,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
},
|
}, Margin = new Thickness(0,0,10,0)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -178,6 +177,7 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
private static readonly Color DefaultColor = Color.FromHex("#1116");
|
private static readonly Color DefaultColor = Color.FromHex("#1116");
|
||||||
private static readonly Color MarginColor = Color.FromHex("#222E");
|
private static readonly Color MarginColor = Color.FromHex("#222E");
|
||||||
private const int MaxItemsBeforeScroll = 10;
|
private const int MaxItemsBeforeScroll = 10;
|
||||||
|
private const int MarginSizeBetweenElements = 2;
|
||||||
|
|
||||||
public VBoxContainer List { get; }
|
public VBoxContainer List { get; }
|
||||||
public int Depth { get; }
|
public int Depth { get; }
|
||||||
@@ -201,15 +201,18 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
List.AddChild(new PanelContainer
|
List.AddChild(new PanelContainer
|
||||||
{
|
{
|
||||||
Children = { element },
|
Children = { element },
|
||||||
Margin = new Thickness(0,0,0, 2),
|
Margin = new Thickness(0,0,0, MarginSizeBetweenElements),
|
||||||
PanelOverride = new StyleBoxFlat {BackgroundColor = DefaultColor}
|
PanelOverride = new StyleBoxFlat {BackgroundColor = DefaultColor}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveFromMenu(ContextMenuElement element)
|
public void RemoveFromMenu(ContextMenuElement element)
|
||||||
{
|
{
|
||||||
List.RemoveChild(element.Parent!);
|
if (element.Parent != null)
|
||||||
InvalidateMeasure();
|
{
|
||||||
|
List.RemoveChild(element.Parent);
|
||||||
|
InvalidateMeasure();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Vector2 MeasureOverride(Vector2 availableSize)
|
protected override Vector2 MeasureOverride(Vector2 availableSize)
|
||||||
@@ -226,7 +229,7 @@ namespace Content.Client.UserInterface.ContextMenu
|
|||||||
{
|
{
|
||||||
return listSize;
|
return listSize;
|
||||||
}
|
}
|
||||||
listSize.Y = MaxItemsBeforeScroll * 32 + MaxItemsBeforeScroll * 2;
|
listSize.Y = MaxItemsBeforeScroll * 32 + MaxItemsBeforeScroll * MarginSizeBetweenElements;
|
||||||
return listSize;
|
return listSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user