Skip to content

Commit cb49ca4

Browse files
committed
Use canonical roster ordering for pagination
1 parent 46b98b2 commit cb49ca4

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

UI/MultiBotUnitsRootUI.lua

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,32 +2619,27 @@ local function createInviteControls(controlFrame)
26192619
end
26202620
end
26212621

2622+
-- MB_CANONICAL_PAGINATION_ORDER_A2_V1_BEGIN
26222623
local function createBrowseButton(controlFrame)
26232624
controlFrame.addButton("Browse", 0, 180, "Interface\\AddOns\\MultiBot\\Icons\\browse.blp", MultiBot.L("tips.units.browse"))
26242625
.doLeft = function()
26252626
local unitsButton = MultiBot.frames.MultiBar.buttons[UNITS_BUTTON_NAME]
26262627
local unitsFrame = unitsButton.parent.frames[UNITS_FRAME_NAME]
2627-
local sourceTable = getUnitsSourceTable(unitsButton)
2628-
local total = sourceTable and #sourceTable or 0
2629-
if total == 0 then
2628+
local total = tonumber(unitsButton.limit) or 0
2629+
if total <= 0 then
26302630
return
26312631
end
26322632

2633-
local fromIndex = (unitsButton.to or UNITS_PAGE_SIZE) + 1
2634-
local toIndex = fromIndex + UNITS_PAGE_SIZE - 1
2633+
local fromIndex = (tonumber(unitsButton.to) or UNITS_PAGE_SIZE) + 1
26352634
if fromIndex > total then
26362635
fromIndex = 1
2637-
toIndex = math.min(UNITS_PAGE_SIZE, total)
2638-
end
2639-
if toIndex > total then
2640-
toIndex = total
26412636
end
26422637

2643-
local display = getDisplayableUnits(unitsFrame, sourceTable)
2644-
hideTrackedVisibleUnits(unitsButton, unitsFrame)
2645-
layoutVisibleUnits(unitsButton, unitsFrame, display, fromIndex, math.min(toIndex, #display))
2638+
unitsButton.from = fromIndex
2639+
relayoutUnitsDisplay(unitsButton, unitsFrame)
26462640
end
26472641
end
2642+
-- MB_CANONICAL_PAGINATION_ORDER_A2_V1_END
26482643

26492644
function MultiBot.InitializeUnitsRootUI(tMultiBar)
26502645
if not tMultiBar or not tMultiBar.addButton or not tMultiBar.addFrame then

0 commit comments

Comments
 (0)