mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Allow main menu gamebar scroll to loop (#14841)
This commit is contained in:
parent
569df37442
commit
ecf6295b4a
@ -102,14 +102,24 @@ local function buttonbar_formspec(self)
|
||||
end
|
||||
|
||||
local function buttonbar_buttonhandler(self, fields)
|
||||
if fields[self.btn_prev_name] and self.cur_page > 1 then
|
||||
if fields[self.btn_prev_name] then
|
||||
if self.cur_page > 1 then
|
||||
self.cur_page = self.cur_page - 1
|
||||
return true
|
||||
elseif self.cur_page == 1 then
|
||||
self.cur_page = self.num_pages
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if fields[self.btn_next_name] and self.cur_page < self.num_pages then
|
||||
if fields[self.btn_next_name] then
|
||||
if self.cur_page < self.num_pages then
|
||||
self.cur_page = self.cur_page + 1
|
||||
return true
|
||||
elseif self.cur_page == self.num_pages then
|
||||
self.cur_page = 1
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
for _, btn in ipairs(self.buttons) do
|
||||
|
Loading…
Reference in New Issue
Block a user