Fixed interact rects not being calculated correctly for subinventory slots, the tooltip of a parent item isn't shown when highlighting a contained item

This commit is contained in:
Joonas Rikkonen
2017-08-27 18:10:17 +03:00
parent 79f7ce7071
commit e7f4d1474e
@@ -247,6 +247,9 @@ namespace Barotrauma
{ {
subRect.Y = subRect.Y - subRect.Height - 10; subRect.Y = subRect.Y - subRect.Height - 10;
container.Inventory.slots[i].Rect = subRect; container.Inventory.slots[i].Rect = subRect;
container.Inventory.slots[i].InteractRect = subRect;
container.Inventory.slots[i].InteractRect.Inflate(5, 5);
} }
container.Inventory.isSubInventory = true; container.Inventory.isSubInventory = true;
@@ -284,7 +287,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (slots[i].IsHighlighted && !slots[i].Disabled && Items[i] != null) if (slots[i].InteractRect.Contains(PlayerInput.MousePosition) && !slots[i].Disabled && Items[i] != null)
{ {
string toolTip = ""; string toolTip = "";
if (GameMain.DebugDraw) if (GameMain.DebugDraw)