]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix some text overflow bugs in HUD (#26615)
authoreoineoineoin <github@eoinrul.es>
Mon, 1 Apr 2024 00:07:13 +0000 (01:07 +0100)
committerGitHub <noreply@github.com>
Mon, 1 Apr 2024 00:07:13 +0000 (20:07 -0400)
* Don't clip text in item status

* Fix overflow in examine tooltip

---------

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
Content.Client/Examine/ExamineSystem.cs
Content.Client/UserInterface/Systems/Inventory/Controls/ItemStatusPanel.xaml

index 1be472b06d67a5766596ee1fd37a7ac6eac8961f..45db4efa53ca51a1446aa8b40980ca8d67e2e7eb 100644 (file)
@@ -212,14 +212,16 @@ namespace Content.Client.Examine
             var vBox = new BoxContainer
             {
                 Name = "ExaminePopupVbox",
-                Orientation = LayoutOrientation.Vertical
+                Orientation = LayoutOrientation.Vertical,
+                MaxWidth = _examineTooltipOpen.MaxWidth
             };
             panel.AddChild(vBox);
 
             var hBox = new BoxContainer
             {
                 Orientation = LayoutOrientation.Horizontal,
-                SeparationOverride = 5
+                SeparationOverride = 5,
+                Margin = new Thickness(6, 0, 6, 0)
             };
 
             vBox.AddChild(hBox);
@@ -229,8 +231,7 @@ namespace Content.Client.Examine
                 var spriteView = new SpriteView
                 {
                     OverrideDirection = Direction.South,
-                    SetSize = new Vector2(32, 32),
-                    Margin = new Thickness(2, 0, 2, 0),
+                    SetSize = new Vector2(32, 32)
                 };
                 spriteView.SetEntity(target);
                 hBox.AddChild(spriteView);
@@ -238,19 +239,17 @@ namespace Content.Client.Examine
 
             if (knowTarget)
             {
-                hBox.AddChild(new Label
-                {
-                    Text = Identity.Name(target, EntityManager, player),
-                    HorizontalExpand = true,
-                });
+                var itemName = FormattedMessage.RemoveMarkup(Identity.Name(target, EntityManager, player));
+                var labelMessage = FormattedMessage.FromMarkup($"[bold]{itemName}[/bold]");
+                var label = new RichTextLabel();
+                label.SetMessage(labelMessage);
+                hBox.AddChild(label);
             }
             else
             {
-                hBox.AddChild(new Label
-                {
-                    Text = "???",
-                    HorizontalExpand = true,
-                });
+                var label = new RichTextLabel();
+                label.SetMessage(FormattedMessage.FromMarkup("[bold]???[/bold]"));
+                hBox.AddChild(label);
             }
 
             panel.Measure(Vector2Helpers.Infinity);
index 2c622b82b9e0172622400e3899b8005752e9defb..d469e6ced037b7caca2525983a45a1f574db43bd 100644 (file)
@@ -1,4 +1,4 @@
-<controls:ItemStatusPanel
+<controls:ItemStatusPanel
     xmlns="https://spacestation14.io"
     xmlns:controls="clr-namespace:Content.Client.UserInterface.Systems.Inventory.Controls"
     xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
@@ -18,7 +18,7 @@
         </PanelContainer.PanelOverride>
         <BoxContainer Orientation="Vertical" SeparationOverride="0">
             <BoxContainer Name="StatusContents" Orientation="Vertical"/>
-            <Label Name="ItemNameLabel" ClipText="True" StyleClasses="ItemStatus"/>
+            <Label Name="ItemNameLabel" StyleClasses="ItemStatus"/>
         </BoxContainer>
     </PanelContainer>
 </controls:ItemStatusPanel>