fix: hovering on bag slot item
This commit is contained in:
@@ -1600,6 +1600,35 @@ function Guda_BagFrame_ClearHighlightedSlots()
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlight a specific bag button in the toolbar
|
||||
function Guda_BagFrame_HighlightBagButton(bagID)
|
||||
if not bagID then return end
|
||||
|
||||
-- Bag 0 (backpack) has no button in the toolbar, only bags 1-4
|
||||
if bagID == 0 then return end
|
||||
|
||||
-- Bag buttons are named: Guda_BagFrame_Toolbar_BagSlot1 through BagSlot4
|
||||
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
||||
local button = getglobal(buttonName)
|
||||
|
||||
if button then
|
||||
-- Set the button's pushed texture to highlight it
|
||||
button:LockHighlight()
|
||||
end
|
||||
end
|
||||
|
||||
-- Clear bag button highlighting
|
||||
function Guda_BagFrame_ClearBagButtonHighlight()
|
||||
-- Clear highlight from all bag buttons (1-4, no button for bag 0)
|
||||
for bagID = 1, 4 do
|
||||
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
|
||||
local button = getglobal(buttonName)
|
||||
if button then
|
||||
button:UnlockHighlight()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Initialize
|
||||
function BagFrame:Initialize()
|
||||
-- Hook default bag functions
|
||||
|
||||
@@ -1051,6 +1051,43 @@ function Guda_BankFrame_ClearHighlightedSlots()
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlight a specific bank bag button in the toolbar
|
||||
function Guda_BankFrame_HighlightBagButton(bagID)
|
||||
if not bagID then return end
|
||||
|
||||
local buttonName
|
||||
if bagID == -1 then
|
||||
-- Main bank container
|
||||
buttonName = "Guda_BankFrame_Toolbar_BankBagMain"
|
||||
else
|
||||
-- Bank bags are bagID 5-10
|
||||
buttonName = "Guda_BankFrame_Toolbar_BankBag" .. bagID
|
||||
end
|
||||
|
||||
local button = getglobal(buttonName)
|
||||
if button then
|
||||
button:LockHighlight()
|
||||
end
|
||||
end
|
||||
|
||||
-- Clear bank bag button highlighting
|
||||
function Guda_BankFrame_ClearBagButtonHighlight()
|
||||
-- Clear highlight from main bank button
|
||||
local mainButton = getglobal("Guda_BankFrame_Toolbar_BankBagMain")
|
||||
if mainButton then
|
||||
mainButton:UnlockHighlight()
|
||||
end
|
||||
|
||||
-- Clear highlight from bank bag buttons (5-10)
|
||||
for bagID = 5, 10 do
|
||||
local buttonName = "Guda_BankFrame_Toolbar_BankBag" .. bagID
|
||||
local button = getglobal(buttonName)
|
||||
if button then
|
||||
button:UnlockHighlight()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Drag handlers for bank bag slots
|
||||
function Guda_BankBagSlot_OnDragStart(button, bagID)
|
||||
if not bagID or bagID == -1 then return end
|
||||
|
||||
@@ -257,6 +257,18 @@ end
|
||||
|
||||
-- OnEnter handler (show tooltip)
|
||||
function Guda_ItemButton_OnEnter(self)
|
||||
-- Highlight the corresponding bag button in the footer (works for empty and filled slots)
|
||||
if not self.otherChar and self.bagID then
|
||||
if self.isBank then
|
||||
-- Bank item - highlight bank bag button
|
||||
Guda_BankFrame_HighlightBagButton(self.bagID)
|
||||
else
|
||||
-- Regular bag item - highlight bag button
|
||||
Guda_BagFrame_HighlightBagButton(self.bagID)
|
||||
end
|
||||
end
|
||||
|
||||
-- Early return for empty slots (no tooltip needed)
|
||||
if not self.hasItem or not self.itemData then
|
||||
return
|
||||
end
|
||||
@@ -292,6 +304,15 @@ end
|
||||
function Guda_ItemButton_OnLeave(self)
|
||||
GameTooltip:Hide()
|
||||
ResetCursor()
|
||||
|
||||
-- Clear bag button highlighting
|
||||
if not self.otherChar then
|
||||
if self.isBank then
|
||||
Guda_BankFrame_ClearBagButtonHighlight()
|
||||
else
|
||||
Guda_BagFrame_ClearBagButtonHighlight()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- OnDragStart handler
|
||||
|
||||
Reference in New Issue
Block a user