diff --git a/frames/bag.lua b/frames/bag.lua index ad8f213a..71643cd6 100644 --- a/frames/bag.lua +++ b/frames/bag.lua @@ -234,6 +234,7 @@ function bagProto:SwitchToBank() self.isReagentBank = false BankFrame.selectedTab = 1 self.frame:SetTitle(L:G("Bank")) + self:Wipe() end ------- diff --git a/frames/grid.lua b/frames/grid.lua index 88928c26..28edde59 100644 --- a/frames/grid.lua +++ b/frames/grid.lua @@ -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 @@ -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) @@ -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 diff --git a/frames/item.lua b/frames/item.lua index fc8f568e..0b50451e 100644 --- a/frames/item.lua +++ b/frames/item.lua @@ -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 @@ -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) diff --git a/frames/section.lua b/frames/section.lua index e221996b..d8d848a2 100644 --- a/frames/section.lua +++ b/frames/section.lua @@ -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 diff --git a/views/listview.lua b/views/listview.lua index 68918a21..8c2526b2 100644 --- a/views/listview.lua +++ b/views/listview.lua @@ -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