From 7661625803480782de52d62f2919d597f3430f41 Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Sun, 4 Jan 2026 17:47:37 +0400 Subject: [PATCH] fix: opening bags when equipped item is dragged --- UI/BagFrame.lua | 23 +++++++++++++++++++++-- UI/BankFrame.lua | 23 +++++++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index 20ebe8a..fdc8e17 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -276,9 +276,28 @@ function BagFrame:Update() end -- If cursor is holding an item (mid-drag), only update lock states, don't rebuild UI + -- BUT only if we already have items displayed - otherwise we need to do initial build if CursorHasItem and CursorHasItem() then - self:UpdateLockStates() - return + -- Check if we have any displayed items + local hasDisplayedItems = false + for _, bagParent in pairs(bagParents) do + if bagParent then + local children = { bagParent:GetChildren() } + for _, button in ipairs(children) do + if button.hasItem and button:IsShown() then + hasDisplayedItems = true + break + end + end + end + if hasDisplayedItems then break end + end + + if hasDisplayedItems then + self:UpdateLockStates() + return + end + -- If no items displayed yet, continue with full update end -- Mark all existing buttons as not in use (we'll mark active ones during display) diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua index 4e2a5a9..c3f087b 100644 --- a/UI/BankFrame.lua +++ b/UI/BankFrame.lua @@ -128,9 +128,28 @@ function BankFrame:Update() end -- If cursor is holding an item (mid-drag), only update lock states, don't rebuild UI + -- BUT only if we already have items displayed - otherwise we need to do initial build if CursorHasItem and CursorHasItem() then - self:UpdateLockStates() - return + -- Check if we have any displayed items + local hasDisplayedItems = false + for _, bankBagParent in pairs(bankBagParents) do + if bankBagParent then + local children = { bankBagParent:GetChildren() } + for _, button in ipairs(children) do + if button.hasItem and button:IsShown() then + hasDisplayedItems = true + break + end + end + end + if hasDisplayedItems then break end + end + + if hasDisplayedItems then + self:UpdateLockStates() + return + end + -- If no items displayed yet, continue with full update end -- Mark all existing buttons as not in use (we'll mark active ones during display)