From a9b969b58f3f82a6fa148badccf01cad1789fee6 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Fri, 24 Feb 2017 16:28:21 +0100 Subject: [PATCH] TouchMenu: keep file/exit button on the right References #2555. --- frontend/ui/widget/touchmenu.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frontend/ui/widget/touchmenu.lua b/frontend/ui/widget/touchmenu.lua index c5888c344..69945422a 100644 --- a/frontend/ui/widget/touchmenu.lua +++ b/frontend/ui/widget/touchmenu.lua @@ -203,7 +203,7 @@ function TouchMenuBar:init() local icon_sep = LineWidget:new{ style = k == 1 and "solid" or "none", dimen = Geom:new{ - w = Screen:scaleBySize(2), + w = icon_sep_width, h = self.height, } } @@ -219,6 +219,18 @@ function TouchMenuBar:init() for i, sep in ipairs(self.icon_seps) do local current_icon = i == k - 1 or i == k self.icon_seps[i].style = current_icon and "solid" or "none" + + -- if this is the before last seperator then extend it to put the last icon on the right + if i == #self.icon_seps - 1 then + self.icon_seps[i].dimen = Geom:new{ + -- self.width is the screen width + -- content_width is the width of the icons + -- (math.min(spacing_width, Screen:scaleBySize(20)) * #self.icons *2) is the combined width of spacing/separators + -- icon_sep_width is the standard icon separator width + w = self.width - content_width - (math.min(spacing_width, Screen:scaleBySize(20)) * #self.icons *2) + icon_sep_width, + h = self.height, + } + end end self.menu:switchMenuTab(k) end