fix: on hovering bag slot, bag item slots are highlighted
This commit is contained in:
@@ -1469,6 +1469,53 @@ function Guda_BagSlot_OnEnter(button, bagID)
|
|||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Highlight all item slots belonging to a specific bag by dimming others
|
||||||
|
function Guda_BagFrame_HighlightBagSlots(bagID)
|
||||||
|
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
||||||
|
if not itemContainer then
|
||||||
|
addon:Debug("HighlightBagSlots: itemContainer not found")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local highlightCount = 0
|
||||||
|
local dimCount = 0
|
||||||
|
|
||||||
|
-- Iterate through all children (item buttons)
|
||||||
|
local children = { itemContainer:GetChildren() }
|
||||||
|
for _, button in ipairs(children) do
|
||||||
|
-- Check if this is an item button
|
||||||
|
if button.hasItem ~= nil and button:IsShown() then
|
||||||
|
if button.bagID == bagID then
|
||||||
|
-- This button belongs to the hovered bag - keep it bright
|
||||||
|
button:SetAlpha(1.0)
|
||||||
|
highlightCount = highlightCount + 1
|
||||||
|
else
|
||||||
|
-- This button belongs to a different bag - dim it
|
||||||
|
button:SetAlpha(0.25)
|
||||||
|
dimCount = dimCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
addon:Debug(string.format("HighlightBagSlots: Highlighted %d slots, dimmed %d slots for bagID %d", highlightCount, dimCount, bagID))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Clear all highlighting by restoring full opacity to all slots
|
||||||
|
function Guda_BagFrame_ClearHighlightedSlots()
|
||||||
|
local itemContainer = getglobal("Guda_BagFrame_ItemContainer")
|
||||||
|
if not itemContainer then return end
|
||||||
|
|
||||||
|
-- Iterate through all children (item buttons)
|
||||||
|
local children = { itemContainer:GetChildren() }
|
||||||
|
for _, button in ipairs(children) do
|
||||||
|
-- Check if this is an item button
|
||||||
|
if button.hasItem ~= nil and button:IsShown() then
|
||||||
|
-- Restore full opacity
|
||||||
|
button:SetAlpha(1.0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Initialize
|
-- Initialize
|
||||||
function BagFrame:Initialize()
|
function BagFrame:Initialize()
|
||||||
-- Hook default bag functions
|
-- Hook default bag functions
|
||||||
|
|||||||
@@ -294,9 +294,11 @@
|
|||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
Guda_BagSlot_OnEnter(this, 1)
|
Guda_BagSlot_OnEnter(this, 1)
|
||||||
|
Guda_BagFrame_HighlightBagSlots(1)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
Guda_BagFrame_ClearHighlightedSlots()
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||||
@@ -325,9 +327,11 @@
|
|||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
Guda_BagSlot_OnEnter(this, 2)
|
Guda_BagSlot_OnEnter(this, 2)
|
||||||
|
Guda_BagFrame_HighlightBagSlots(2)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
Guda_BagFrame_ClearHighlightedSlots()
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||||
@@ -356,9 +360,11 @@
|
|||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
Guda_BagSlot_OnEnter(this, 3)
|
Guda_BagSlot_OnEnter(this, 3)
|
||||||
|
Guda_BagFrame_HighlightBagSlots(3)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
Guda_BagFrame_ClearHighlightedSlots()
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||||
@@ -387,9 +393,11 @@
|
|||||||
</OnClick>
|
</OnClick>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
Guda_BagSlot_OnEnter(this, 4)
|
Guda_BagSlot_OnEnter(this, 4)
|
||||||
|
Guda_BagFrame_HighlightBagSlots(4)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
Guda_BagFrame_ClearHighlightedSlots()
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||||
@@ -437,9 +445,11 @@
|
|||||||
GameTooltip:SetOwner(this, "ANCHOR_TOP")
|
GameTooltip:SetOwner(this, "ANCHOR_TOP")
|
||||||
GameTooltip:SetText("Toggle Keyring")
|
GameTooltip:SetText("Toggle Keyring")
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
|
Guda_BagFrame_HighlightBagSlots(-2)
|
||||||
</OnEnter>
|
</OnEnter>
|
||||||
<OnLeave>
|
<OnLeave>
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
|
Guda_BagFrame_ClearHighlightedSlots()
|
||||||
</OnLeave>
|
</OnLeave>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user