Rotation icons: make 'em dynamic. (#7440)

Followup to #7306.

As discussed there, the only way to make everybody happy is to make 'em context-aware. At which point, trying to make the fact that it's a *device* rotation and not a *content* one come across in the icon design loses its interest, and would actually only further muddy the issue.

So, these are similar is spirit to the traditional rotation icons in pretty much anything that can rotate text content, with a special inspiration from the Kindle 4 & PocketBook UI.

Fix #7429
This commit is contained in:
NiLuJe
2021-03-29 05:12:22 +02:00
committed by GitHub
parent f3341d9dc0
commit e33476996a
11 changed files with 771 additions and 21 deletions

View File

@@ -486,8 +486,11 @@ function ConfigOption:init()
end
-- Icons (ex: columns, text align, with PDF)
if self.options[c].item_icons then
local items_count = #self.options[c].item_icons
local item_icons = self.options[c].item_icons_func and
self.options[c].item_icons_func(self.config.configurable, self.config.document) or
self.options[c].item_icons
if item_icons then
local items_count = #item_icons
local icon_max_height = math.min(option_height, max_icon_height)
local icon_max_width = math.floor(option_widget_width / items_count)
local icon_size = math.min(icon_max_height, icon_max_width)
@@ -497,17 +500,17 @@ function ConfigOption:init()
-- We don't want the underline to be that far away from the image content,
-- so we use some negative padding to eat a bit on their padding.
local underline_padding = - math.floor(0.05 * icon_size)
for d = 1, #self.options[c].item_icons do
for d = 1, items_count do
local option_item = OptionIconItem:new{
icon = IconWidget:new{
icon = self.options[c].item_icons[d],
icon = item_icons[d],
dim = not enabled,
width = icon_size,
height = icon_size,
},
underline_padding = underline_padding,
padding_left = d > 1 and horizontal_half_padding,
padding_right = d < #self.options[c].item_icons and horizontal_half_padding,
padding_right = d < items_count and horizontal_half_padding,
color = d == current_item and (enabled and Blitbuffer.COLOR_BLACK or Blitbuffer.COLOR_DARK_GRAY) or Blitbuffer.COLOR_WHITE,
enabled = enabled,
}