Skip to content

Commit

Permalink
Fixed a bug where recent items wasn't properly being reset in some ca…
Browse files Browse the repository at this point in the history
…ses.
  • Loading branch information
Cidan committed Nov 29, 2023
1 parent eaa8ce2 commit 0df5ffa
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frames/bag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ end
---@param dirtyItems table<number, table<number, ItemMixin>>
function bagProto:Draw(dirtyItems)
self:UpdateCellWidth()
for _, i in pairs(self.recentItems:GetAllCells()) do
local bagid, slotid = i:GetMixin():GetItemLocation():GetBagAndSlot()
if bagid and slotid then
self.itemsByBagAndSlot[bagid] = self.itemsByBagAndSlot[bagid] or {}
self.itemsByBagAndSlot[bagid][slotid] = nil
end
end
self.recentItems.content:Wipe()
if database:GetBagView(self.kind) == const.BAG_VIEW.ONE_BAG then
views:OneBagView(self, dirtyItems)
elseif database:GetBagView(self.kind) == const.BAG_VIEW.SECTION_GRID then
Expand Down
1 change: 1 addition & 0 deletions frames/grid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function gridProto:Wipe()
for _, cell in pairs(self.cells) do
cell:Release()
end
wipe(self.cellToColumn)
wipe(self.columns)
wipe(self.cells)
end
Expand Down
4 changes: 4 additions & 0 deletions frames/section.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ function sectionProto:HasItem(item)
return false
end

function sectionProto:GetAllCells()
return self.content.cells
end

function sectionProto:Release()
sectionFrame._pool:Release(self)
end
Expand Down
1 change: 1 addition & 0 deletions views/listview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function views:ListView(bag, dirtyItems)
bag.freeReagentBagSlotsButton:SetFreeSlots(freeReagentSlotsData.bagid, freeReagentSlotsData.slotid, freeReagentSlotsData.count, true)

bag.recentItems:SetMaxCellWidth(sizeInfo.itemsPerRow)
bag.recentItems:SetMaxCellWidth(1)
-- Loop through each section and draw it's size.
local recentW, recentH = bag.recentItems:Draw()
for _, section in pairs(bag.sections) do
Expand Down

0 comments on commit 0df5ffa

Please sign in to comment.