loop menu pages when it reaches ends

the following graph shows my idea.

1->2->3->4->5->6->7->8->9->10
└----------------------------------------┘
This commit is contained in:
frankyifei
2015-08-01 19:14:40 +09:30
parent f7142cfcbe
commit f7fb103abc
2 changed files with 10 additions and 2 deletions

View File

@@ -805,6 +805,8 @@ function Menu:onNextPage()
if end_position ~= self.selected.y then
self:updateItems(end_position)
end
self.page = 1
self:updateItems(1)
end
return true
end
@@ -812,6 +814,8 @@ end
function Menu:onPrevPage()
if self.page > 1 then
self.page = self.page - 1
elseif self.page == 1 then
self.page =self.page_num
end
self:updateItems(1)
return true