]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
add tooltip with entity name on inventory hover (#22203)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Fri, 8 Dec 2023 02:38:07 +0000 (21:38 -0500)
committerGitHub <noreply@github.com>
Fri, 8 Dec 2023 02:38:07 +0000 (21:38 -0500)
Content.Client/UserInterface/Systems/Storage/Controls/ItemGridPiece.cs

index 1441681e6805f93b0729ba7385c660b1260eb890..ece668c945426390a297c5df17bf0defec5bc904 100644 (file)
@@ -5,6 +5,7 @@ using Content.Shared.Storage;
 using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.CustomControls;
 
 namespace Content.Client.UserInterface.Systems.Storage.Controls;
 
@@ -55,9 +56,22 @@ public sealed class ItemGridPiece : Control
         Visible = true;
         MouseFilter = MouseFilterMode.Pass;
 
+        TooltipSupplier = SupplyTooltip;
+
         OnThemeUpdated();
     }
 
+    private Control? SupplyTooltip(Control sender)
+    {
+        if (_storageController.IsDragging)
+            return null;
+
+        return new Tooltip
+        {
+            Text = _entityManager.GetComponent<MetaDataComponent>(Entity).EntityName
+        };
+    }
+
     protected override void OnThemeUpdated()
     {
         base.OnThemeUpdated();