diff --git a/UI/BagFrame.xml b/UI/BagFrame.xml index faa1716..fe5f411 100644 --- a/UI/BagFrame.xml +++ b/UI/BagFrame.xml @@ -638,7 +638,8 @@ - + + @@ -654,15 +655,8 @@ - - - -- Clear search focus when clicking in item area - local searchBox = getglobal("Guda_BagFrame_SearchBar_SearchBox") - if searchBox then - searchBox:ClearFocus() - end - - + diff --git a/UI/ItemButton.lua b/UI/ItemButton.lua index 50b84d6..a9dc3fd 100644 --- a/UI/ItemButton.lua +++ b/UI/ItemButton.lua @@ -108,6 +108,20 @@ function Guda_ItemButton_OnLoad(self) iconFrame:Hide() self.questIcon = iconFrame end + + -- Ensure the item button sits above its container backdrop and is mouse-enabled + local parent = self:GetParent() + if parent and parent.GetFrameLevel then + -- Place button above parent backdrop/mouse layer to reliably receive drops + local parentLevel = parent:GetFrameLevel() + if parentLevel and self:GetFrameLevel() <= parentLevel + 1 then + self:SetFrameLevel(parentLevel + 2) + end + end + + if self.EnableMouse then + self:EnableMouse(true) + end end -- Set item data @@ -484,6 +498,11 @@ function Guda_ItemButton_OnDragStart(self, button) -- 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 @@ -499,6 +518,33 @@ function Guda_ItemButton_OnReceiveDrag(self) PickupContainerItem(self.bagID, self.slotID) end +-- Handle mouse-up to emulate Blizzard drop behavior on 1.12 where OnReceiveDrag may not always fire +function Guda_ItemButton_OnMouseUp(self, button) + -- Only handle left-button drops + if button ~= "LeftButton" then return end + + -- Don't allow interaction with other characters' items or in read-only mode + if self.otherChar or self.isReadOnly then + return + end + + -- If the cursor is holding an item, drop/swap into this slot + if CursorHasItem and CursorHasItem() then + PickupContainerItem(self.bagID, self.slotID) + return + end + + -- Otherwise, normal click behavior is handled by OnClick +end + +-- OnDragStop handler (optional cleanup) +function Guda_ItemButton_OnDragStop(self) + -- Reset cursor to default to avoid lingering special cursors + if ResetCursor then + ResetCursor() + end +end + -- Stack split callback (called by StackSplitFrame) local function ItemButton_SplitStack(self, split) if self.bagID and self.slotID then diff --git a/UI/ItemButton.xml b/UI/ItemButton.xml index dccdb67..0086eb1 100644 --- a/UI/ItemButton.xml +++ b/UI/ItemButton.xml @@ -47,9 +47,15 @@ Guda_ItemButton_OnClick(this, arg1) + + Guda_ItemButton_OnMouseUp(this, arg1) + Guda_ItemButton_OnDragStart(this, arg1) + + Guda_ItemButton_OnDragStop(this) + Guda_ItemButton_OnReceiveDrag(this)