perf: improvement

This commit is contained in:
Vati
2026-03-02 13:17:16 +04:00
parent 30d9ef688e
commit 3148e80cc0
6 changed files with 73 additions and 49 deletions
+11 -3
View File
@@ -3366,14 +3366,22 @@ function BagFrame:Initialize()
end, "BagFrame")
-- Update when items get locked/unlocked (debounced for trading, mailing, etc.)
local lockUpdatePending = false
addon.Modules.Events:Register("ITEM_LOCK_CHANGED", function()
if currentViewChar then return end
if not Guda_BagFrame:IsShown() then return end
-- In Category View, just update lock states visually without full redraw
-- In Category View, debounce lock state updates (fires rapidly during drags)
local viewType = addon.Modules.DB:GetSetting("bagViewType") or "single"
if viewType == "category" then
-- Only update lock visual states, don't trigger full redraw
BagFrame:UpdateLockStates()
if not lockUpdatePending then
lockUpdatePending = true
Guda_ScheduleTimer(0.05, function()
lockUpdatePending = false
if Guda_BagFrame:IsShown() and not currentViewChar then
BagFrame:UpdateLockStates()
end
end)
end
return
end
-- Use slightly longer delay for lock changes in single view (they fire rapidly during drags)
+10 -16
View File
@@ -1897,23 +1897,17 @@ end
function Guda_ItemButton_OnLeave(self)
-- Delay hide of drop indicator to allow mouse to move to indicator frame
if activeCategoryDropIndicator == self and categoryDropIndicator and categoryDropIndicator:IsShown() then
-- Use OnUpdate delay to check if mouse moved to the indicator
local elapsed = 0
local checkFrame = CreateFrame("Frame")
checkFrame:SetScript("OnUpdate", function()
elapsed = elapsed + arg1
if elapsed >= 0.05 then
this:SetScript("OnUpdate", nil)
-- If mouse is over the indicator, don't hide
if categoryDropIndicator and categoryDropIndicator:IsMouseOver() then
return
end
-- If mouse is over the parent button, don't hide
if activeCategoryDropIndicator and MouseIsOver(activeCategoryDropIndicator) then
return
end
HideCategoryDropIndicator()
-- Use pooled timer to check if mouse moved to the indicator (avoids frame leak)
Guda_ScheduleTimer(0.05, function()
-- If mouse is over the indicator, don't hide
if categoryDropIndicator and categoryDropIndicator:IsMouseOver() then
return
end
-- If mouse is over the parent button, don't hide
if activeCategoryDropIndicator and MouseIsOver(activeCategoryDropIndicator) then
return
end
HideCategoryDropIndicator()
end)
else
HideCategoryDropIndicator()
+2 -2
View File
@@ -136,7 +136,7 @@ function Guda_SettingsPopup_OnShow(self)
local bankColumns = Guda.Modules.DB:GetSetting("bankColumns") or 10
local iconSize = Guda.Modules.DB:GetSetting("iconSize") or 37
local iconFontSize = Guda.Modules.DB:GetSetting("iconFontSize") or 12
local iconSpacing = Guda.Modules.DB:GetSetting("iconSpacing") or 3
local iconSpacing = Guda.Modules.DB:GetSetting("iconSpacing") or 4
local lockBags = Guda.Modules.DB:GetSetting("lockBags")
if lockBags == nil then
lockBags = false
@@ -600,7 +600,7 @@ function Guda_SettingsPopup_IconSpacingSlider_OnLoad(self)
self:SetMinMaxValues(0, 20)
self:SetValueStep(1)
local currentValue = Guda.Modules.DB:GetSetting("iconSpacing") or 3
local currentValue = Guda.Modules.DB:GetSetting("iconSpacing") or 4
self:SetValue(currentValue)
end