fix: keyring icon

This commit is contained in:
Salikh Gurgenidze
2025-11-18 21:41:23 +04:00
parent 5a2b302c85
commit d3a4ad9923
2 changed files with 38 additions and 25 deletions
+18 -6
View File
@@ -1604,13 +1604,19 @@ end
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
local buttonName
if bagID == -2 then
-- Keyring button
buttonName = "Guda_BagFrame_Toolbar_KeyringButton"
elseif bagID >= 1 and bagID <= 4 then
-- Bag buttons 1-4
buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
else
-- Bag 0 (backpack) has no button in the toolbar
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()
@@ -1619,7 +1625,7 @@ end
-- Clear bag button highlighting
function Guda_BagFrame_ClearBagButtonHighlight()
-- Clear highlight from all bag buttons (1-4, no button for bag 0)
-- Clear highlight from all bag buttons (1-4)
for bagID = 1, 4 do
local buttonName = "Guda_BagFrame_Toolbar_BagSlot" .. bagID
local button = getglobal(buttonName)
@@ -1627,6 +1633,12 @@ function Guda_BagFrame_ClearBagButtonHighlight()
button:UnlockHighlight()
end
end
-- Clear keyring button highlight
local keyringButton = getglobal("Guda_BagFrame_Toolbar_KeyringButton")
if keyringButton then
keyringButton:UnlockHighlight()
end
end
-- Initialize
+20 -19
View File
@@ -434,7 +434,7 @@
</Button>
<!-- Keyring Button -->
<Button name="$parent_KeyringButton">
<Button name="$parent_KeyringButton" inherits="ItemButtonTemplate">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
@@ -445,33 +445,34 @@
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parent_Icon">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Color r="0.8" g="0.8" b="0.8"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
local icon = getglobal(this:GetName().."_Icon")
if icon then
icon:SetTexture("Interface\\Icons\\INV_Misc_Key_03")
icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
-- Hide borders (same as bag slots)
local normalTexture = getglobal(this:GetName().."NormalTexture")
if normalTexture then
normalTexture:SetTexture(nil)
normalTexture:Hide()
end
local iconBorder = getglobal(this:GetName().."IconBorder")
if iconBorder then
iconBorder:Hide()
end
-- Set keyring icon using SetItemButtonTexture (same as bag slots)
SetItemButtonTexture(this, "Interface\\Icons\\INV_Misc_Key_03")
-- Optionally tint it cyan to distinguish it
SetItemButtonTextureVertexColor(this, 0.7, 1.0, 1.0)
</OnLoad>
<OnClick>
Guda_BagFrame_ToggleKeyring()
</OnClick>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_TOP")
GameTooltip:SetText("Toggle Keyring")
GameTooltip:SetText("Keyring", 1.0, 1.0, 1.0)
local numSlots = GetContainerNumSlots(-2) or 0
GameTooltip:AddLine(string.format("%d Slots", numSlots), 0.8, 0.8, 0.8)
GameTooltip:AddLine("(Click to toggle)", 0.5, 0.8, 0.5)
GameTooltip:Show()
Guda_BagFrame_HighlightBagSlots(-2)
</OnEnter>