From 9448a5251501e7495503c0962febaea16cd71aa1 Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 24 Sep 2017 15:22:06 +0200 Subject: [PATCH] [UX] Smaller bottom menu icons (#3257) And unrelated small optimisation in imagewidget --- frontend/ui/widget/configdialog.lua | 13 +++++++------ frontend/ui/widget/imagewidget.lua | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/ui/widget/configdialog.lua b/frontend/ui/widget/configdialog.lua index 8dad08fe9..7577fa845 100644 --- a/frontend/ui/widget/configdialog.lua +++ b/frontend/ui/widget/configdialog.lua @@ -417,20 +417,21 @@ function MenuBar:init() local line_thickness = Size.line.thick local config_options = self.config_dialog.config_options local menu_items = {} - local icons_width = 0 - local icons_height = 0 + local icon_width = Screen:scaleBySize(40) + local icon_height = icon_width + local icons_width = (icon_width + 2*icon_sep_width) * #config_options + local icons_height = icon_height for c = 1, #config_options do local menu_icon = IconButton:new{ show_parent = self.config_dialog, icon_file = config_options[c].icon, + width = icon_width, + height = icon_height, + scale_for_dpi = false, callback = function() self.config_dialog:handleEvent(Event:new("ShowConfigPanel", c)) end, } - local icon_dimen = menu_icon:getSize() - icons_width = icons_width + icon_dimen.w + 2*icon_sep_width - icons_height = icon_dimen.h > icons_height and icon_dimen.h or icons_height - menu_items[c] = menu_icon end diff --git a/frontend/ui/widget/imagewidget.lua b/frontend/ui/widget/imagewidget.lua index 44cea90be..cde1ad4a1 100644 --- a/frontend/ui/widget/imagewidget.lua +++ b/frontend/ui/widget/imagewidget.lua @@ -200,8 +200,8 @@ function ImageWidget:_render() -- replace blitbuffer with a resizd one if needed local new_bb = nil if self.scale_factor == nil then - -- no scaling, but strech to width and height, only if provided - if self.width and self.height then + -- no scaling, but strech to width and height, only if provided and needed + if self.width and self.height and (self.width ~= bb_w or self.height ~= bb_h) then logger.dbg("ImageWidget: stretching") new_bb = self._bb:scale(self.width, self.height) end