fix: pseudo slot respect and update bank category view properly
This commit is contained in:
+49
-3
@@ -375,9 +375,55 @@ function BagFrame:UpdateChangedSlots(bagID)
|
|||||||
local isCategoryView = (viewType == "category")
|
local isCategoryView = (viewType == "category")
|
||||||
|
|
||||||
if isCategoryView then
|
if isCategoryView then
|
||||||
-- Category view: always do full redraw since items may change categories
|
-- In Category View: update slots that HAVE button mappings in-place
|
||||||
return -1
|
-- AND check for NEW items that arrived in slots without buttons
|
||||||
else
|
local updatedCount = 0
|
||||||
|
for slotID, targetButton in pairs(slotToButton[bagID]) do
|
||||||
|
local currentLink = GetContainerItemLink(bagID, slotID)
|
||||||
|
local cachedLink = targetButton.itemData and targetButton.itemData.link or nil
|
||||||
|
|
||||||
|
local needsUpdate = false
|
||||||
|
if currentLink ~= cachedLink then
|
||||||
|
needsUpdate = true
|
||||||
|
elseif currentLink then
|
||||||
|
local _, currentCount = GetContainerItemInfo(bagID, slotID)
|
||||||
|
local cachedCount = targetButton.itemData and targetButton.itemData.count or 0
|
||||||
|
if currentCount ~= cachedCount then
|
||||||
|
needsUpdate = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if needsUpdate then
|
||||||
|
addon:DebugCategory(" bag %d slot %d: needs update (had=%s, now=%s)", bagID, slotID,
|
||||||
|
cachedLink and "item" or "empty", currentLink and "item" or "empty")
|
||||||
|
if self:UpdateSingleSlot(bagID, slotID, targetButton) then
|
||||||
|
updatedCount = updatedCount + 1
|
||||||
|
else
|
||||||
|
addon:DebugCategory(" bag %d slot %d: UpdateSingleSlot failed -> full redraw", bagID, slotID)
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- CRITICAL: Check for NEW items that arrived in slots WITHOUT button mappings
|
||||||
|
-- Category View only has buttons for filled slots, so new items need full redraw
|
||||||
|
local numSlots = GetContainerNumSlots(bagID)
|
||||||
|
if numSlots and numSlots > 0 then
|
||||||
|
for checkSlotID = 1, numSlots do
|
||||||
|
local hasButton = slotToButton[bagID][checkSlotID] or slotToButton[bagID][tostring(checkSlotID)]
|
||||||
|
if not hasButton then
|
||||||
|
local currentLink = GetContainerItemLink(bagID, checkSlotID)
|
||||||
|
if currentLink then
|
||||||
|
addon:DebugCategory(" bag %d slot %d: NEW item arrived (no button) -> full redraw", bagID, checkSlotID)
|
||||||
|
return -1 -- Trigger full redraw to categorize new item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
addon:DebugCategory("UpdateChangedSlots (category): bag=%d, success, updated %d slots", bagID, updatedCount)
|
||||||
|
return updatedCount
|
||||||
|
elseif not isCategoryView then
|
||||||
-- In Single View: check all slots
|
-- In Single View: check all slots
|
||||||
local numSlots = GetContainerNumSlots(bagID)
|
local numSlots = GetContainerNumSlots(bagID)
|
||||||
if not numSlots or numSlots == 0 then return -1 end
|
if not numSlots or numSlots == 0 then return -1 end
|
||||||
|
|||||||
+15
-2
@@ -2276,6 +2276,7 @@ function BankFrame:Initialize()
|
|||||||
local viewType = addon.Modules.DB:GetSetting("bankViewType") or "single"
|
local viewType = addon.Modules.DB:GetSetting("bankViewType") or "single"
|
||||||
if viewType == "category" then
|
if viewType == "category" then
|
||||||
-- Only update lock visual states, don't trigger full redraw
|
-- Only update lock visual states, don't trigger full redraw
|
||||||
|
-- (pseudo empty placeholders would be destroyed by full redraw)
|
||||||
BankFrame:UpdateLockStates()
|
BankFrame:UpdateLockStates()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -2336,6 +2337,10 @@ function BankFrame:Initialize()
|
|||||||
addon:DebugCategory(" -> slot emptied, incremental update done, no full redraw needed")
|
addon:DebugCategory(" -> slot emptied, incremental update done, no full redraw needed")
|
||||||
else
|
else
|
||||||
addon:DebugCategory(" -> item added, incremental update done")
|
addon:DebugCategory(" -> item added, incremental update done")
|
||||||
|
-- Safety-net: item appeared, verify with full redraw in category view
|
||||||
|
if viewType == "category" then
|
||||||
|
ScheduleBankFrameUpdate(0.3)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -2410,8 +2415,9 @@ function BankFrame:Initialize()
|
|||||||
-- The cache will be updated on next full redraw if needed
|
-- The cache will be updated on next full redraw if needed
|
||||||
return
|
return
|
||||||
elseif realItems == cacheItems then
|
elseif realItems == cacheItems then
|
||||||
-- No change in item count - might be item swap, skip update
|
-- No change in item count - might be item swap or stale data
|
||||||
addon:DebugCategory(" -> item count unchanged (%d), skipping", realItems)
|
addon:DebugCategory(" -> item count unchanged (%d), scheduling safety-net redraw", realItems)
|
||||||
|
ScheduleBankFrameUpdate(0.3)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Items were added - need full redraw
|
-- Items were added - need full redraw
|
||||||
@@ -2444,6 +2450,13 @@ function BankFrame:Initialize()
|
|||||||
if result >= 0 then
|
if result >= 0 then
|
||||||
-- Incremental update succeeded - no need for full redraw for THIS bag
|
-- Incremental update succeeded - no need for full redraw for THIS bag
|
||||||
-- But don't cancel pending redraws - other changes might need them
|
-- But don't cancel pending redraws - other changes might need them
|
||||||
|
-- Safety-net for category view when items were added (result > 0 = slots changed)
|
||||||
|
if result > 0 then
|
||||||
|
local catViewType = addon.Modules.DB:GetSetting("bankViewType") or "single"
|
||||||
|
if catViewType == "category" then
|
||||||
|
ScheduleBankFrameUpdate(0.3)
|
||||||
|
end
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- Fall through to full redraw
|
-- Fall through to full redraw
|
||||||
|
|||||||
Reference in New Issue
Block a user