Fix some text overflow bugs in HUD (#26615)

* Don't clip text in item status

* Fix overflow in examine tooltip

---------

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
eoineoineoin
2024-04-01 01:07:13 +01:00
committed by GitHub
parent c62e90afb3
commit 9b08c2c908
2 changed files with 15 additions and 16 deletions

View File

@@ -212,14 +212,16 @@ namespace Content.Client.Examine
var vBox = new BoxContainer var vBox = new BoxContainer
{ {
Name = "ExaminePopupVbox", Name = "ExaminePopupVbox",
Orientation = LayoutOrientation.Vertical Orientation = LayoutOrientation.Vertical,
MaxWidth = _examineTooltipOpen.MaxWidth
}; };
panel.AddChild(vBox); panel.AddChild(vBox);
var hBox = new BoxContainer var hBox = new BoxContainer
{ {
Orientation = LayoutOrientation.Horizontal, Orientation = LayoutOrientation.Horizontal,
SeparationOverride = 5 SeparationOverride = 5,
Margin = new Thickness(6, 0, 6, 0)
}; };
vBox.AddChild(hBox); vBox.AddChild(hBox);
@@ -229,8 +231,7 @@ namespace Content.Client.Examine
var spriteView = new SpriteView var spriteView = new SpriteView
{ {
OverrideDirection = Direction.South, OverrideDirection = Direction.South,
SetSize = new Vector2(32, 32), SetSize = new Vector2(32, 32)
Margin = new Thickness(2, 0, 2, 0),
}; };
spriteView.SetEntity(target); spriteView.SetEntity(target);
hBox.AddChild(spriteView); hBox.AddChild(spriteView);
@@ -238,19 +239,17 @@ namespace Content.Client.Examine
if (knowTarget) if (knowTarget)
{ {
hBox.AddChild(new Label var itemName = FormattedMessage.RemoveMarkup(Identity.Name(target, EntityManager, player));
{ var labelMessage = FormattedMessage.FromMarkup($"[bold]{itemName}[/bold]");
Text = Identity.Name(target, EntityManager, player), var label = new RichTextLabel();
HorizontalExpand = true, label.SetMessage(labelMessage);
}); hBox.AddChild(label);
} }
else else
{ {
hBox.AddChild(new Label var label = new RichTextLabel();
{ label.SetMessage(FormattedMessage.FromMarkup("[bold]???[/bold]"));
Text = "???", hBox.AddChild(label);
HorizontalExpand = true,
});
} }
panel.Measure(Vector2Helpers.Infinity); panel.Measure(Vector2Helpers.Infinity);

View File

@@ -1,4 +1,4 @@
<controls:ItemStatusPanel <controls:ItemStatusPanel
xmlns="https://spacestation14.io" xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Systems.Inventory.Controls" xmlns:controls="clr-namespace:Content.Client.UserInterface.Systems.Inventory.Controls"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
@@ -18,7 +18,7 @@
</PanelContainer.PanelOverride> </PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical" SeparationOverride="0"> <BoxContainer Orientation="Vertical" SeparationOverride="0">
<BoxContainer Name="StatusContents" Orientation="Vertical"/> <BoxContainer Name="StatusContents" Orientation="Vertical"/>
<Label Name="ItemNameLabel" ClipText="True" StyleClasses="ItemStatus"/> <Label Name="ItemNameLabel" StyleClasses="ItemStatus"/>
</BoxContainer> </BoxContainer>
</PanelContainer> </PanelContainer>
</controls:ItemStatusPanel> </controls:ItemStatusPanel>