fix: hover container highlight slots

This commit is contained in:
Salikh Gurgenidze
2026-01-04 17:30:11 +04:00
parent 5943d28887
commit a4388012e6
+27 -20
View File
@@ -2138,19 +2138,22 @@ end
-- Highlight all item slots belonging to a specific bag by dimming others -- Highlight all item slots belonging to a specific bag by dimming others
function Guda_BagFrame_HighlightBagSlots(bagID) function Guda_BagFrame_HighlightBagSlots(bagID)
-- Use the tracked itemButtons list because actual buttons are parented under per-bag parents -- Iterate through bagParents to get all item buttons (same approach as BankFrame)
if not itemButtons or type(itemButtons) ~= "table" then return end
local highlightCount, dimCount = 0, 0 local highlightCount, dimCount = 0, 0
for _, button in ipairs(itemButtons) do for _, bagParent in pairs(bagParents) do
if button and button:IsShown() and button.hasItem ~= nil and not button.isBagSlot then if bagParent then
if button.bagID == bagID then local children = { bagParent:GetChildren() }
button:SetAlpha(1.0) for _, button in ipairs(children) do
highlightCount = highlightCount + 1 if button and button:IsShown() and button.hasItem ~= nil and not button.isBagSlot then
else if button.bagID == bagID then
button:SetAlpha(0.25) button:SetAlpha(1.0)
dimCount = dimCount + 1 highlightCount = highlightCount + 1
else
button:SetAlpha(0.25)
dimCount = dimCount + 1
end
end
end end
end end
end end
@@ -2159,16 +2162,20 @@ end
-- Clear all highlighting by restoring full opacity to all slots -- Clear all highlighting by restoring full opacity to all slots
function Guda_BagFrame_ClearHighlightedSlots() function Guda_BagFrame_ClearHighlightedSlots()
-- Restore alpha to whatever the search filter dictates (pfUI style). If no search, full opacity. -- Restore alpha to whatever the search filter dictates (pfUI style). If no search, full opacity.
if not itemButtons or type(itemButtons) ~= "table" then return end
local searchActive = BagFrame and BagFrame.IsSearchActive and BagFrame:IsSearchActive() local searchActive = BagFrame and BagFrame.IsSearchActive and BagFrame:IsSearchActive()
for _, button in ipairs(itemButtons) do
if button and button:IsShown() and button.hasItem ~= nil and not button.isBagSlot then for _, bagParent in pairs(bagParents) do
if searchActive and BagFrame and BagFrame.PassesSearchFilter then if bagParent then
local matches = BagFrame:PassesSearchFilter(button.itemData) local children = { bagParent:GetChildren() }
button:SetAlpha(matches and 1.0 or 0.25) for _, button in ipairs(children) do
else if button and button:IsShown() and button.hasItem ~= nil and not button.isBagSlot then
button:SetAlpha(1.0) if searchActive and BagFrame and BagFrame.PassesSearchFilter then
local matches = BagFrame:PassesSearchFilter(button.itemData)
button:SetAlpha(matches and 1.0 or 0.25)
else
button:SetAlpha(1.0)
end
end
end end
end end
end end