clean: unused code

This commit is contained in:
Salikh Gurgenidze
2025-11-22 11:57:23 +04:00
parent 39e7fe2747
commit 0c16f3241e
-116
View File
@@ -661,120 +661,4 @@ function Guda_ItemButton_OnLeave(self)
Guda_BagFrame_ClearBagButtonHighlight()
end
end
end
-- OnDragStart handler
function Guda_ItemButton_OnDragStart(self, button)
-- Don't allow dragging other characters' items or in read-only mode
if self.otherChar or self.isReadOnly then
return
end
-- Only allow left button drag
if button == "LeftButton" and self.hasItem then
-- Ensure the global click catcher doesn't intercept the drag/drop
local cc = getglobal and getglobal("Guda_ClickCatcher")
if cc and cc.Hide and cc:IsShown() then
cc:Hide()
end
PickupContainerItem(self.bagID, self.slotID)
end
end
-- OnReceiveDrag handler
function Guda_ItemButton_OnReceiveDrag(self)
-- Don't allow dragging to other characters' items or in read-only mode
if self.otherChar or self.isReadOnly then
return
end
-- Place the item being dragged
PickupContainerItem(self.bagID, self.slotID)
-- Trigger UI update after drop completes (was skipped during drag)
if addon and addon.Modules and addon.Modules.BagFrame then
addon.Modules.BagFrame:Update()
end
end
-- Handle mouse-up to emulate Blizzard drop behavior on 1.12 where OnReceiveDrag may not always fire
-- (rollback) no custom OnMouseUp; rely on Blizzard default
-- OnMouseDown handler - pick up item when pressing mouse button (classic pattern)
-- (rollback) no custom OnMouseDown; rely on Blizzard default
-- OnDragStop handler (optional cleanup)
function Guda_ItemButton_OnDragStop(self)
-- Reset cursor to default to avoid lingering special cursors
if ResetCursor then
ResetCursor()
end
-- Trigger UI update after drag completes (was skipped during drag)
if addon and addon.Modules and addon.Modules.BagFrame then
addon.Modules.BagFrame:Update()
end
end
-- Stack split callback (called by StackSplitFrame)
local function ItemButton_SplitStack(self, split)
if self.bagID and self.slotID then
SplitContainerItem(self.bagID, self.slotID, split)
end
end
-- OnClick handler
function Guda_ItemButton_OnClick(self, button)
-- Don't allow interaction with other characters' items or in read-only mode
if self.otherChar or self.isReadOnly then return end
-- Set the split callback
self.SplitStack = ItemButton_SplitStack
-- Modified clicks
if IsShiftKeyDown() then
if button == "LeftButton" and self.hasItem then
-- Get live count and link
local _, count = GetContainerItemInfo(self.bagID, self.slotID)
local itemLink = GetContainerItemLink(self.bagID, self.slotID)
-- Shift+Left Click on stackable item: Show split stack dialog
if count and count > 1 then
OpenStackSplitFrame(count, self, "BOTTOMRIGHT", "TOPRIGHT")
return
end
-- If not stackable or only 1 item, link to chat
if itemLink and ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(itemLink)
end
end
return
elseif IsControlKeyDown() then
-- Ctrl+Click: Dress up (if applicable)
if self.hasItem then
local itemLink = GetContainerItemLink(self.bagID, self.slotID)
if itemLink then
DressUpItemLink(itemLink)
end
end
return
end
if button == "LeftButton" then
-- Left clicks are handled by MouseDown/MouseUp to prevent instant self-drop.
return
elseif button == "RightButton" then
-- Right click: Use item (only if slot has an item)
if self.hasItem then
UseContainerItem(self.bagID, self.slotID)
end
end
end
-- Release all buttons
function Guda_ReleaseAllButtons()
for _, button in pairs(buttonPool) do
button:Hide()
button:ClearAllPoints()
end
end