[UX] Smaller bottom menu icons (#3257)

And unrelated small optimisation in imagewidget
pull/3259/head
poire-z 7 years ago committed by GitHub
parent 2735c6d369
commit 9448a52515

@ -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

@ -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

Loading…
Cancel
Save