From 02001fb1cee63f276ebd07fbaf966d47d2b443a9 Mon Sep 17 00:00:00 2001 From: Vati Date: Sat, 28 Feb 2026 04:36:04 +0400 Subject: [PATCH] fix: category view markers --- UI/BagFrame.lua | 48 ++--------------------------------------------- UI/ItemButton.lua | 19 +++---------------- 2 files changed, 5 insertions(+), 62 deletions(-) diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua index c01f952..88101ff 100644 --- a/UI/BagFrame.lua +++ b/UI/BagFrame.lua @@ -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) diff --git a/UI/ItemButton.lua b/UI/ItemButton.lua index ebea395..b86d90f 100644 --- a/UI/ItemButton.lua +++ b/UI/ItemButton.lua @@ -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