fix: category view markers

This commit is contained in:
Vati
2026-02-28 04:36:04 +04:00
parent 597a66ec9c
commit 02001fb1ce
2 changed files with 5 additions and 62 deletions
+2 -46
View File
@@ -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)
+3 -16
View File
@@ -643,7 +643,6 @@ local function ResetButtonVisualState(self)
if self.unusableOverlay then self.unusableOverlay:Hide() end
HideJunkIcon(self)
if self.categoryMarkIcon then self.categoryMarkIcon:Hide() end
if self.categoryMarkShadow then self.categoryMarkShadow:Hide() end
-- Clear cooldown overlay
local cd = getglobal(self:GetName().."Cooldown") or self.cooldown
@@ -1219,32 +1218,20 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
if categoryMarkTexture then
local iconTex = getglobal(self:GetName().."IconTexture") or getglobal(self:GetName().."Icon") or self.icon or self.Icon
local anchor = iconTex or self
-- Create mark textures lazily
if not self.categoryMarkShadow then
self.categoryMarkShadow = self:CreateTexture(nil, "OVERLAY")
self.categoryMarkShadow:SetVertexColor(0, 0, 0, 1)
end
if not self.categoryMarkIcon then
self.categoryMarkIcon = self:CreateTexture(nil, "OVERLAY")
self.categoryMarkIcon = self:CreateTexture(nil, "OVERLAY", 7)
end
-- Size relative to icon (roughly 40% of icon display size)
local markSize = math.max(10, math.floor(iconSize * 0.3)) + 3
local shadowSize = markSize + 2
self.categoryMarkShadow:SetWidth(shadowSize)
self.categoryMarkShadow:SetHeight(shadowSize)
self.categoryMarkShadow:ClearAllPoints()
self.categoryMarkShadow:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", 1, 1)
self.categoryMarkIcon:SetWidth(markSize)
self.categoryMarkIcon:SetHeight(markSize)
self.categoryMarkIcon:ClearAllPoints()
self.categoryMarkIcon:SetPoint("BOTTOMLEFT", anchor, "BOTTOMLEFT", 2, 2)
self.categoryMarkShadow:SetTexture(categoryMarkTexture)
self.categoryMarkShadow:Show()
self.categoryMarkIcon:SetTexture(categoryMarkTexture)
self.categoryMarkIcon:SetVertexColor(1, 1, 1, 1)
self.categoryMarkIcon:SetAlpha(1)
self.categoryMarkIcon:Show()
else
if self.categoryMarkIcon then self.categoryMarkIcon:Hide() end
if self.categoryMarkShadow then self.categoryMarkShadow:Hide() end
end
-- Search filtering and junk opacity