From c84dcb28d7b0d55b9278e2829f59b4eaf8581f15 Mon Sep 17 00:00:00 2001 From: shikulja Date: Thu, 4 Jul 2024 01:46:16 +0300 Subject: [PATCH 1/3] [module] Bags - update focus logic --- modules/bags.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/bags.lua b/modules/bags.lua index 0007f48da..967215c12 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -983,11 +983,32 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () frame.search.edit:SetTextColor(.5,.5,.5,1) frame.search.edit:SetScript("OnEditFocusGained", function() - this:SetText("") + if this:GetText() == T["Search"] then + this:SetText("") + end end) frame.search.edit:SetScript("OnEditFocusLost", function() - this:SetText(T["Search"]) + if not pfUI.bag:IsShown() then + this:SetText(T["Search"]) + for bag=-2, 11 do + local bagsize = GetContainerNumSlots(bag) + if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end + for slot=1, bagsize do + pfUI.bags[bag].slots[slot].frame:SetAlpha(1) + end + end + end + end) + + frame.search.edit:SetScript("OnLeave", function() + if GetMouseFocus() ~= this then + this:ClearFocus() + end + end) + + frame.search:SetScript("OnHide", function() + frame.search.edit:SetText(T["Search"]) for bag=-2, 11 do local bagsize = GetContainerNumSlots(bag) if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end From d3c1929f4dcb33ad0c4bdd969e08b0055fc9828a Mon Sep 17 00:00:00 2001 From: shikulja Date: Thu, 4 Jul 2024 02:39:07 +0300 Subject: [PATCH 2/3] ups --- modules/bags.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/bags.lua b/modules/bags.lua index 967215c12..1703ef672 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -1001,23 +1001,20 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () end end) - frame.search.edit:SetScript("OnLeave", function() - if GetMouseFocus() ~= this then - this:ClearFocus() - end - end) - - frame.search:SetScript("OnHide", function() - frame.search.edit:SetText(T["Search"]) + frame.keys:SetScript("OnLeave", function () for bag=-2, 11 do local bagsize = GetContainerNumSlots(bag) if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end for slot=1, bagsize do - pfUI.bags[bag].slots[slot].frame:SetAlpha(1) + pfUI.bags[bag].slots[slot].frame:SetAlpha(1) end end end) + frame.search:SetScript("OnHide", function() + frame.search.edit:SetText(T["Search"]) + end) + frame.search.edit:SetScript("OnTextChanged", function() if this:GetText() == T["Search"] then return end for bag=-2, 11 do From 0b471bf3d4c5790b0c592be6cdbe085fb96a2bf5 Mon Sep 17 00:00:00 2001 From: shikulja Date: Thu, 4 Jul 2024 03:19:58 +0300 Subject: [PATCH 3/3] revert back and add check I have no idea how to exclude the pfUI.bags[bag] check --- modules/bags.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/bags.lua b/modules/bags.lua index 1703ef672..acf0deb94 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -1001,18 +1001,25 @@ pfUI:RegisterModule("bags", "vanilla:tbc", function () end end) - frame.keys:SetScript("OnLeave", function () - for bag=-2, 11 do - local bagsize = GetContainerNumSlots(bag) - if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end - for slot=1, bagsize do - pfUI.bags[bag].slots[slot].frame:SetAlpha(1) - end + frame.search.edit:SetScript("OnLeave", function() + if GetMouseFocus() ~= this then + this:ClearFocus() end end) frame.search:SetScript("OnHide", function() frame.search.edit:SetText(T["Search"]) + for bag = -2, 11 do + if pfUI.bags[bag] then + local bagsize = GetContainerNumSlots(bag) + if bag == -2 and pfUI.bag.showKeyring == true then bagsize = GetKeyRingSize() end + for slot = 1, bagsize do + if pfUI.bags[bag] then + pfUI.bags[bag].slots[slot].frame:SetAlpha(1) + end + end + end + end end) frame.search.edit:SetScript("OnTextChanged", function()