@@ -59,7 +59,8 @@ local function fillPages( items, maximumPages, height, ax, ay )
5959
6060 for i = 1 , # items do
6161 currentPage [# currentPage + 1 ] = items [i ]
62- items [i ]:setRelativePosition ( ax , ay + # currentPage - 1 )
62+ items [i ]:setOrigin ( ax , ay )
63+ items [i ]:setRelativePosition ( 0 , # currentPage - 1 )
6364
6465 -- Add the current page to the "pages" table if it is full or if we have
6566 -- added all the items to add.
179180-- Creates the buttons to scroll through the pages.
180181--
181182function UIPaginatedList :addButtons ()
182- self .buttonPrev = UIButton ( 0 , 0 , self .ax + self .w - 2 , self . ay + self .h - 1 , 1 , 1 , function () self :scrollPage ( - 1 ) end )
183+ self .buttonPrev = UIButton ( self . ax , self .ay , self .w - 2 , self .h - 1 , 1 , 1 , function () self :scrollPage ( - 1 ) end )
183184 self .buttonPrev :setIcon ( ' ui_prev_element' )
184- self .buttonNext = UIButton ( 0 , 0 , self .ax + self .w - 1 , self . ay + self .h - 1 , 1 , 1 , function () self :scrollPage ( 1 ) end )
185+ self .buttonNext = UIButton ( self . ax , self .ay , self .w - 1 , self .h - 1 , 1 , 1 , function () self :scrollPage ( 1 ) end )
185186 self .buttonNext :setIcon ( ' ui_next_element' )
186187
187188 self :addChild ( self .buttonPrev )
@@ -277,4 +278,20 @@ function UIPaginatedList:setFocus( focus )
277278 self .pages [self .currentPage ][self .cursor ]:setFocus ( focus )
278279end
279280
281+ ---
282+ -- Forwards changes to the origin of the paginated list to the children and
283+ -- all items on each page.
284+ -- @tparam number ox The new origin along the x-axis.
285+ -- @tparam number oy The new origin along the y-axis.
286+ --
287+ function UIPaginatedList :setOrigin ( ox , oy )
288+ UIPaginatedList .super .setOrigin ( self , ox , oy )
289+
290+ for _ , page in ipairs ( self .pages ) do
291+ for _ , item in ipairs ( page ) do
292+ item :setOrigin ( ox , oy )
293+ end
294+ end
295+ end
296+
280297return UIPaginatedList
0 commit comments