fix: category view markers
This commit is contained in:
+2
-46
@@ -336,52 +336,8 @@ function BagFrame:UpdateChangedSlots(bagID)
|
||||
local isCategoryView = (viewType == "category")
|
||||
|
||||
if isCategoryView then
|
||||
-- In Category View: update slots that HAVE button mappings
|
||||
-- AND check for NEW items that arrived in slots without buttons
|
||||
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
|
||||
-- Pass the button directly to avoid type mismatch lookup issues
|
||||
if self:UpdateSingleSlot(bagID, slotID, targetButton) then
|
||||
updatedCount = updatedCount + 1
|
||||
else
|
||||
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
|
||||
-- If slot has an item but no button mapping -> new item arrived
|
||||
-- Check both numeric and potential string keys
|
||||
local hasButton = slotToButton[bagID][checkSlotID] or slotToButton[bagID][tostring(checkSlotID)]
|
||||
if not hasButton then
|
||||
local currentLink = GetContainerItemLink(bagID, checkSlotID)
|
||||
if currentLink then
|
||||
return -1 -- Trigger full redraw to categorize new item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return updatedCount
|
||||
-- Category view: always do full redraw since items may change categories
|
||||
return -1
|
||||
else
|
||||
-- In Single View: check all slots
|
||||
local numSlots = GetContainerNumSlots(bagID)
|
||||
|
||||
Reference in New Issue
Block a user