fix: alt click instead of ctrl click
This commit is contained in:
+25
-33
@@ -333,16 +333,36 @@ function Guda_ItemButton_OnLoad(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:SetScript("OnClick", function()
|
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)
|
local link = GetContainerItemLink(this.bagID, this.slotID)
|
||||||
if link and addon and addon.Modules and addon.Modules.Utils then
|
if link and addon and addon.Modules and addon.Modules.Utils then
|
||||||
local itemID = addon.Modules.Utils:ExtractItemID(link)
|
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)
|
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)
|
addon.Modules.QuestItemBar:PinItem(itemID)
|
||||||
return
|
return
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -768,36 +788,8 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Handle tracking toggle on click
|
-- Handle tracking toggle on click
|
||||||
if not self.isReadOnly and not self.otherChar then
|
-- Note: Tracking toggle is now handled in the main OnClick script above to avoid conflicts
|
||||||
local old_OnClick = self:GetScript("OnClick")
|
-- and unified with QuestItemBar pinning logic.
|
||||||
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
|
|
||||||
|
|
||||||
self:Show()
|
self:Show()
|
||||||
else
|
else
|
||||||
|
|||||||
+3
-3
@@ -321,7 +321,7 @@ function QuestItemBar:Update()
|
|||||||
UseContainerItem(this.bagID, this.slotID)
|
UseContainerItem(this.bagID, this.slotID)
|
||||||
end
|
end
|
||||||
elseif arg1 == "RightButton" then
|
elseif arg1 == "RightButton" then
|
||||||
if IsControlKeyDown() then
|
if IsAltKeyDown() then
|
||||||
-- Clear pin for this slot
|
-- Clear pin for this slot
|
||||||
local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {}
|
local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {}
|
||||||
pins[index] = nil
|
pins[index] = nil
|
||||||
@@ -353,7 +353,7 @@ function QuestItemBar:Update()
|
|||||||
-- Pinning from cursor is hard in 1.12 without hooks.
|
-- Pinning from cursor is hard in 1.12 without hooks.
|
||||||
end
|
end
|
||||||
elseif arg1 == "RightButton" then
|
elseif arg1 == "RightButton" then
|
||||||
if IsControlKeyDown() then
|
if IsAltKeyDown() then
|
||||||
-- Clear pin for this slot
|
-- Clear pin for this slot
|
||||||
local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {}
|
local pins = addon.Modules.DB:GetSetting("questBarPinnedItems") or {}
|
||||||
pins[index] = nil
|
pins[index] = nil
|
||||||
@@ -374,7 +374,7 @@ function QuestItemBar:Update()
|
|||||||
GameTooltip:SetText("Quest Slot " .. index)
|
GameTooltip:SetText("Quest Slot " .. index)
|
||||||
GameTooltip:AddLine("Auto-fills with usable quest items.", 1, 1, 1)
|
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("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()
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+14
-5
@@ -44,6 +44,8 @@ function TrackedItemBar:ScanForTrackedItems()
|
|||||||
itemCounts[id] = 0
|
itemCounts[id] = 0
|
||||||
itemTextures[id] = texture
|
itemTextures[id] = texture
|
||||||
itemLinks[id] = link
|
itemLinks[id] = link
|
||||||
|
itemCounts[id .. "_bag"] = bagID
|
||||||
|
itemCounts[id .. "_slot"] = slotID
|
||||||
table.insert(itemOrder, id)
|
table.insert(itemOrder, id)
|
||||||
end
|
end
|
||||||
itemCounts[id] = itemCounts[id] + count
|
itemCounts[id] = itemCounts[id] + count
|
||||||
@@ -57,7 +59,9 @@ function TrackedItemBar:ScanForTrackedItems()
|
|||||||
itemID = id,
|
itemID = id,
|
||||||
texture = itemTextures[id],
|
texture = itemTextures[id],
|
||||||
count = itemCounts[id],
|
count = itemCounts[id],
|
||||||
link = itemLinks[id]
|
link = itemLinks[id],
|
||||||
|
bagID = itemCounts[id .. "_bag"],
|
||||||
|
slotID = itemCounts[id .. "_slot"]
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -113,9 +117,9 @@ function TrackedItemBar:Update()
|
|||||||
button.hasItem = true
|
button.hasItem = true
|
||||||
button.itemData = { link = info.link }
|
button.itemData = { link = info.link }
|
||||||
button.itemID = info.itemID
|
button.itemID = info.itemID
|
||||||
button.isReadOnly = true -- Don't allow regular clicks/interaction like usage?
|
button.bagID = info.bagID
|
||||||
-- Actually user didn't specify usage, but "action bar type" suggests it might be usable.
|
button.slotID = info.slotID
|
||||||
-- But "tracked items" usually means materials or currencies.
|
button.isReadOnly = false -- Changed to false to allow interaction and tooltips showing usage
|
||||||
|
|
||||||
local icon = getglobal(button:GetName() .. "IconTexture")
|
local icon = getglobal(button:GetName() .. "IconTexture")
|
||||||
icon:SetTexture(info.texture)
|
icon:SetTexture(info.texture)
|
||||||
@@ -126,7 +130,7 @@ function TrackedItemBar:Update()
|
|||||||
countText:Show()
|
countText:Show()
|
||||||
|
|
||||||
button:SetScript("OnClick", function()
|
button:SetScript("OnClick", function()
|
||||||
if IsControlKeyDown() then
|
if IsAltKeyDown() and arg1 == "LeftButton" then
|
||||||
-- Un-track item
|
-- Un-track item
|
||||||
local itemID = this.itemID
|
local itemID = this.itemID
|
||||||
if itemID then
|
if itemID then
|
||||||
@@ -140,6 +144,11 @@ function TrackedItemBar:Update()
|
|||||||
end
|
end
|
||||||
TrackedItemBar:Update()
|
TrackedItemBar:Update()
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- Use item
|
||||||
|
if this.bagID and this.slotID then
|
||||||
|
UseContainerItem(this.bagID, this.slotID)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user