From 3fd550bd50958bbc523163833fa4e8aed552565e Mon Sep 17 00:00:00 2001 From: poire-z Date: Fri, 8 Jul 2022 17:19:56 +0200 Subject: [PATCH] TouchMenu: don't allow swipe south to close menu This is mostly needed because opening the menu with swipe is actually done by handling a pan south event, and so the final swipe event is another event, that is then handled by TouchMenu, which would straight away close itself. --- frontend/ui/widget/touchmenu.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/ui/widget/touchmenu.lua b/frontend/ui/widget/touchmenu.lua index 848ea9157..21aa9c080 100644 --- a/frontend/ui/widget/touchmenu.lua +++ b/frontend/ui/widget/touchmenu.lua @@ -756,7 +756,7 @@ function TouchMenu:switchMenuTab(tab_num) self:updateItems() end -function TouchMenu:backToUpperMenu() +function TouchMenu:backToUpperMenu(no_close) if #self.item_table_stack ~= 0 then self.item_table = table.remove(self.item_table_stack) self.page = 1 @@ -771,7 +771,7 @@ function TouchMenu:backToUpperMenu() self.parent_id = nil end self:updateItems() - else + elseif not no_close then self:closeMenu() end end @@ -821,7 +821,10 @@ function TouchMenu:onSwipe(arg, ges_ev) elseif direction == "north" then self:closeMenu() elseif direction == "south" then - self:onBack() + -- We don't allow the menu to be closed (this is also necessary as + -- a swipe south will be emitted when done opening the menu with + -- swipe, as the event handled for that is pan south). + self:backToUpperMenu(true) end end