From e11e13af876a6ea7cfa282a45b1242ea61377ac2 Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Tue, 23 Dec 2025 17:30:24 +0400 Subject: [PATCH] fix: alt click instead of ctrl click --- UI/ItemButton.lua | 58 +++++++++++++++++++------------------------ UI/QuestItemBar.lua | 6 ++--- UI/TrackedItemBar.lua | 19 ++++++++++---- 3 files changed, 42 insertions(+), 41 deletions(-) diff --git a/UI/ItemButton.lua b/UI/ItemButton.lua index acc979b..5d83090 100644 --- a/UI/ItemButton.lua +++ b/UI/ItemButton.lua @@ -333,16 +333,36 @@ function Guda_ItemButton_OnLoad(self) end self:SetScript("OnClick", function() - if IsAltKeyDown() and this.hasItem and not this.otherChar and not this.isReadOnly then + if IsAltKeyDown() and arg1 == "LeftButton" and this.hasItem and not this.otherChar and not this.isReadOnly then local link = GetContainerItemLink(this.bagID, this.slotID) if link and addon and addon.Modules and addon.Modules.Utils then local itemID = addon.Modules.Utils:ExtractItemID(link) - if itemID and addon.Modules.QuestItemBar and addon.Modules.QuestItemBar.PinItem then + if itemID then local isQuest = IsQuestItem(this.bagID, this.slotID) - if isQuest then + if isQuest and addon.Modules.QuestItemBar and addon.Modules.QuestItemBar.PinItem then addon.Modules.QuestItemBar:PinItem(itemID) return end + + local trackedItems = addon.Modules.DB:GetSetting("trackedItems") or {} + if trackedItems[itemID] then + trackedItems[itemID] = nil + else + trackedItems[itemID] = true + end + addon.Modules.DB:SetSetting("trackedItems", trackedItems) + + -- Update all item buttons + if Guda.Modules.BagFrame and Guda.Modules.BagFrame.Update then + Guda.Modules.BagFrame:Update() + end + if Guda.Modules.BankFrame and Guda.Modules.BankFrame.Update then + Guda.Modules.BankFrame:Update() + end + if Guda.Modules.TrackedItemBar and Guda.Modules.TrackedItemBar.Update then + Guda.Modules.TrackedItemBar:Update() + end + return end end end @@ -768,36 +788,8 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha end -- Handle tracking toggle on click - if not self.isReadOnly and not self.otherChar then - local old_OnClick = self:GetScript("OnClick") - self:SetScript("OnClick", function() - if IsControlKeyDown() then - local itemID = addon.Modules.Utils:ExtractItemID(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) - if itemID then - local trackedItems = addon.Modules.DB:GetSetting("trackedItems") or {} - if trackedItems[itemID] then - trackedItems[itemID] = nil - else - trackedItems[itemID] = true - end - addon.Modules.DB:SetSetting("trackedItems", trackedItems) - - -- Update all item buttons - if Guda.Modules.BagFrame and Guda.Modules.BagFrame.Update then - Guda.Modules.BagFrame:Update() - end - if Guda.Modules.BankFrame and Guda.Modules.BankFrame.Update then - Guda.Modules.BankFrame:Update() - end - if Guda.Modules.TrackedItemBar and Guda.Modules.TrackedItemBar.Update then - Guda.Modules.TrackedItemBar:Update() - end - end - elseif old_OnClick then - old_OnClick() - end - end) - end + -- Note: Tracking toggle is now handled in the main OnClick script above to avoid conflicts + -- and unified with QuestItemBar pinning logic. self:Show() else diff --git a/UI/QuestItemBar.lua b/UI/QuestItemBar.lua index 6b5b4c6..2715afd 100644 --- a/UI/QuestItemBar.lua +++ b/UI/QuestItemBar.lua @@ -321,7 +321,7 @@ function QuestItemBar:Update() UseContainerItem(this.bagID, this.slotID) end elseif arg1 == "RightButton" then - if IsControlKeyDown() then + if IsAltKeyDown() then -- Clear pin for this slot local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {} pins[index] = nil @@ -353,7 +353,7 @@ function QuestItemBar:Update() -- Pinning from cursor is hard in 1.12 without hooks. end elseif arg1 == "RightButton" then - if IsControlKeyDown() then + if IsAltKeyDown() then -- Clear pin for this slot local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {} pins[index] = nil @@ -374,7 +374,7 @@ function QuestItemBar:Update() GameTooltip:SetText("Quest Slot " .. index) GameTooltip:AddLine("Auto-fills with usable quest items.", 1, 1, 1) GameTooltip:AddLine("Alt-Click an item in bags to pin it.", 0, 1, 0) - GameTooltip:AddLine("Ctrl-Right-Click to unpin.", 0.5, 0.5, 0.5) + GameTooltip:AddLine("Alt-Right-Click to unpin.", 0.5, 0.5, 0.5) GameTooltip:Show() end diff --git a/UI/TrackedItemBar.lua b/UI/TrackedItemBar.lua index 9433a55..8ff8ee8 100644 --- a/UI/TrackedItemBar.lua +++ b/UI/TrackedItemBar.lua @@ -44,6 +44,8 @@ function TrackedItemBar:ScanForTrackedItems() itemCounts[id] = 0 itemTextures[id] = texture itemLinks[id] = link + itemCounts[id .. "_bag"] = bagID + itemCounts[id .. "_slot"] = slotID table.insert(itemOrder, id) end itemCounts[id] = itemCounts[id] + count @@ -57,7 +59,9 @@ function TrackedItemBar:ScanForTrackedItems() itemID = id, texture = itemTextures[id], count = itemCounts[id], - link = itemLinks[id] + link = itemLinks[id], + bagID = itemCounts[id .. "_bag"], + slotID = itemCounts[id .. "_slot"] }) end end @@ -113,9 +117,9 @@ function TrackedItemBar:Update() button.hasItem = true button.itemData = { link = info.link } button.itemID = info.itemID - button.isReadOnly = true -- Don't allow regular clicks/interaction like usage? - -- Actually user didn't specify usage, but "action bar type" suggests it might be usable. - -- But "tracked items" usually means materials or currencies. + button.bagID = info.bagID + button.slotID = info.slotID + button.isReadOnly = false -- Changed to false to allow interaction and tooltips showing usage local icon = getglobal(button:GetName() .. "IconTexture") icon:SetTexture(info.texture) @@ -126,7 +130,7 @@ function TrackedItemBar:Update() countText:Show() button:SetScript("OnClick", function() - if IsControlKeyDown() then + if IsAltKeyDown() and arg1 == "LeftButton" then -- Un-track item local itemID = this.itemID if itemID then @@ -140,6 +144,11 @@ function TrackedItemBar:Update() end TrackedItemBar:Update() end + else + -- Use item + if this.bagID and this.slotID then + UseContainerItem(this.bagID, this.slotID) + end end end)