Skip to content

Commit

Permalink
Fixed a bug where bank grid items do not show on first load.
Browse files Browse the repository at this point in the history
Fixed a bug where bank grid items would sometimes combine across bag types.
  • Loading branch information
Cidan committed Nov 30, 2023
1 parent bdd6396 commit cabdb4c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions frames/bag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function bagProto:SwitchToBank()
self.isReagentBank = false
BankFrame.selectedTab = 1
self.frame:SetTitle(L:G("Bank"))
self:Wipe()
end

-------
Expand Down
8 changes: 5 additions & 3 deletions frames/grid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ function gridProto:GetContainer()
end

function gridProto:HideScrollBar()
self.bar:Hide()
self.bar:SetAlpha(0)
end

function gridProto:ShowScrollBar()
self.bar:Show()
self.bar:SetAlpha(1)
end
-- Sort will sort the cells in this grid using the given function.
---@param fn fun(a: `T`, b: `T`):boolean
Expand Down Expand Up @@ -206,12 +206,13 @@ function gridProto:Wipe()
wipe(self.cells)
end

local scrollFrameCounter = 0
---@private
---@param g Grid
---@param parent Frame
---@return WowScrollBox
function grid:CreateScrollFrame(g, parent, child)
local box = CreateFrame("Frame", nil, parent, "WowScrollBox") --[[@as WowScrollBox]]
local box = CreateFrame("Frame", "BetterBagsScrollGrid"..scrollFrameCounter, parent, "WowScrollBox") --[[@as WowScrollBox]]
box:SetAllPoints(parent)
box:SetInterpolateScroll(true)

Expand All @@ -229,6 +230,7 @@ function grid:CreateScrollFrame(g, parent, child)
g.box = box
g.view = view
ScrollUtil.InitScrollBoxWithScrollBar(box, bar, view)
scrollFrameCounter = scrollFrameCounter + 1
return box
end

Expand Down
12 changes: 6 additions & 6 deletions frames/item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ end
---@param count number
---@param reagent boolean
function itemProto:SetFreeSlots(bagid, slotid, count, reagent)
if const.BANK_BAGS[bagid] or const.REAGENTBANK_BAGS[bagid] then
self.kind = const.BAG_KIND.BANK
else
self.kind = const.BAG_KIND.BACKPACK
end

if count == 0 then
self.button:Disable()
else
Expand All @@ -166,12 +172,6 @@ function itemProto:SetFreeSlots(bagid, slotid, count, reagent)
self.button:SetID(slotid)
self.frame:SetID(bagid)

if const.BANK_BAGS[bagid] or const.REAGENTBANK_BAGS[bagid] then
self.kind = const.BAG_KIND.BANK
else
self.kind = const.BAG_KIND.BACKPACK
end

ClearItemButtonOverlay(self.button)
self.button:SetHasItem(false)
SetItemButtonCount(self.button, count)
Expand Down
3 changes: 0 additions & 3 deletions frames/section.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ function sectionProto:Grid()
return 0, 0
end
self.frame:SetSize(w + 12, h + self.title:GetHeight() + 6)
if self.fillWidth then
self.frame:SetWidth(self.frame:GetParent():GetWidth() + 12)
end
self.frame:Show()
return w+12, h + self.title:GetHeight() + 6
end
Expand Down
1 change: 0 additions & 1 deletion views/listview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ function views:ListView(bag, dirtyItems)
bag.freeBagSlotsButton:SetFreeSlots(freeSlotsData.bagid, freeSlotsData.slotid, freeSlotsData.count, false)
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.
for _, section in pairs(bag.sections) do
Expand Down

0 comments on commit cabdb4c

Please sign in to comment.