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:
Philip Chan
2022-01-25 08:32:46 +08:00
committed by GitHub
parent 21932c24a2
commit 3af268dd7a
16 changed files with 300 additions and 169 deletions

View File

@@ -73,31 +73,29 @@ function IconButton:update()
end
function IconButton:initGesListener()
if Device:isTouchDevice() then
self.ges_events = {
TapIconButton = {
GestureRange:new{
ges = "tap",
range = self.dimen,
},
doc = "Tap IconButton",
self.ges_events = {
TapIconButton = {
GestureRange:new{
ges = "tap",
range = self.dimen,
},
HoldIconButton = {
GestureRange:new{
ges = "hold",
range = self.dimen,
},
doc = "Hold IconButton",
doc = "Tap IconButton",
},
HoldIconButton = {
GestureRange:new{
ges = "hold",
range = self.dimen,
},
HoldReleaseIconButton = {
GestureRange:new{
ges = "hold_release",
range = self.dimen,
},
doc = "Hold Release IconButton",
}
doc = "Hold IconButton",
},
HoldReleaseIconButton = {
GestureRange:new{
ges = "hold_release",
range = self.dimen,
},
doc = "Hold Release IconButton",
}
end
}
end
function IconButton:onTapIconButton()