From 706d8f17273f4718a2adf5a43c1de5a1dc08abad Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 18 May 2023 22:22:07 +0300
Subject: SL-19732 Fix folder's thumbnail from sticking over folder's content

---
 indra/newview/llinventorypanel.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index edcd45db79..c5d3fa3f7a 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -1311,10 +1311,18 @@ BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask)
             params["inv_type"] = vm_item_p->getInventoryType();
             params["thumbnail_id"] = vm_item_p->getThumbnailUUID();
             params["item_id"] = vm_item_p->getUUID();
-            
+
+            // tooltip should only show over folder, but screen
+            // rect includes items under folder as well
+            LLRect actionable_rect = hover_item_p->calcScreenRect();
+            if (hover_item_p->isOpen() && hover_item_p->hasVisibleChildren())
+            {
+                actionable_rect.mBottom = actionable_rect.mTop - hover_item_p->getItemHeight();
+            }
+
 			LLToolTipMgr::instance().show(LLToolTip::Params()
 					.message(hover_item_p->getToolTip())
-					.sticky_rect(hover_item_p->calcScreenRect())
+					.sticky_rect(actionable_rect)
 					.delay_time(LLView::getTooltipTimeout())
 					.create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
 					.create_params(params));
-- 
cgit v1.2.3