mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Add fine tune in line spacing (#5375)
See https://github.com/koreader/koreader/issues/5312#issuecomment-528506421 Progress widget has a new extra button ⋮ that triggers SpinWidget.
This commit is contained in:
@@ -22,6 +22,7 @@ local ButtonProgressWidget = InputContainer:new{
|
||||
default_position = nil,
|
||||
thin_grey_style = false, -- default to black
|
||||
fine_tune = false, -- no -/+ buttons on the extremities by default
|
||||
more_options = false, -- no "⋮" button
|
||||
}
|
||||
|
||||
function ButtonProgressWidget:init()
|
||||
@@ -50,6 +51,9 @@ function ButtonProgressWidget:update()
|
||||
if self.fine_tune then
|
||||
buttons_count = buttons_count + 2
|
||||
end
|
||||
if self.more_options then
|
||||
buttons_count = buttons_count + 1
|
||||
end
|
||||
local button_width = math.floor(self.width / buttons_count) - 2*button_padding - 2*button_margin - 2*button_bordersize
|
||||
|
||||
-- Minus button on the left
|
||||
@@ -169,6 +173,35 @@ function ButtonProgressWidget:update()
|
||||
end
|
||||
table.insert(self.buttonprogress_content, button)
|
||||
end
|
||||
-- More option button on the right
|
||||
if self.more_options then
|
||||
local margin = button_margin * 6
|
||||
local extra_border_size = 0
|
||||
local button = Button:new{
|
||||
text = "⋮",
|
||||
radius = 0,
|
||||
margin = margin,
|
||||
padding = button_padding,
|
||||
bordersize = button_bordersize + extra_border_size,
|
||||
enabled = true,
|
||||
width = button_width - 2*extra_border_size,
|
||||
preselect = false,
|
||||
text_font_face = self.font_face,
|
||||
text_font_size = self.font_size,
|
||||
callback = function()
|
||||
self.callback("⋮")
|
||||
self:update()
|
||||
end,
|
||||
no_focus = true,
|
||||
hold_callback = function()
|
||||
self.hold_callback("⋮")
|
||||
end,
|
||||
}
|
||||
if self.thin_grey_style then
|
||||
button.frame.color = Blitbuffer.COLOR_DARK_GRAY
|
||||
end
|
||||
table.insert(self.buttonprogress_content, button)
|
||||
end
|
||||
|
||||
UIManager:setDirty(self.show_parrent, function()
|
||||
return "ui", self.dimen
|
||||
|
||||
Reference in New Issue
Block a user