mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Non-Touch: improve bottom menu usability (#8712)
- FocusManager: allow managing sub widgets by merging their "layout" in the main one; make "press" support simpler by handling it as a fake tap event at the center of the focused widget. - Setup gestures on non-touch devices for new focus manager. - ToggleSwitch: use child layout. - ButtonProgressWidget: use child layout. - SpinWidget and DoubleSpinWidget: add keyboard navigation.
This commit is contained in:
@@ -41,6 +41,9 @@ local FrameContainer = WidgetContainer:new{
|
||||
invert = false,
|
||||
allow_mirroring = true,
|
||||
_mirroredUI = BD.mirroredUILayout(),
|
||||
focusable = false,
|
||||
focus_border_size = Size.border.window * 2,
|
||||
focus_border_color = Blitbuffer.COLOR_BLACK,
|
||||
}
|
||||
|
||||
function FrameContainer:getSize()
|
||||
@@ -58,6 +61,27 @@ function FrameContainer:getSize()
|
||||
}
|
||||
end
|
||||
|
||||
function FrameContainer:onFocus()
|
||||
if not self.focusable then
|
||||
return
|
||||
end
|
||||
self._origin_bordersize = self.bordersize
|
||||
self._origin_border_color = self.color
|
||||
self.bordersize = self.focus_border_size
|
||||
self.color = self.focus_border_color
|
||||
return true
|
||||
end
|
||||
|
||||
function FrameContainer:onUnfocus()
|
||||
if not self.focusable then
|
||||
return
|
||||
end
|
||||
self.bordersize = self._origin_bordersize
|
||||
self.color = self._origin_border_color
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function FrameContainer:paintTo(bb, x, y)
|
||||
local my_size = self:getSize()
|
||||
self.dimen = Geom:new{
|
||||
|
||||
Reference in New Issue
Block a user