InputContainer: Fall cleanup ;).

Get rid of the doc & seqtext fields, as they are not actually used (nor
are they particularly useful, the event handler's name should be pretty
self-explanatory).

Also, tweak the key_events documentation to highlight the quirks of the
API, especially as far as array nesting is involved...

Random drive-by cleanup of the declarations of key_events & ges_events
to re-use the existing instance object (now that we know they're sane
;p) for tables with a single member (less GC pressure).
This commit is contained in:
NiLuJe
2022-10-27 02:01:51 +02:00
parent 9b2201a438
commit b523c2e8b9
73 changed files with 464 additions and 484 deletions

View File

@@ -60,58 +60,78 @@ function ReaderRolling:init()
self.key_events = {}
if Device:hasKeys() then
self.key_events.GotoNextView = {
{ {"RPgFwd", "LPgFwd", "Right" } },
doc = "go to next view",
event = "GotoViewRel", args = 1,
{ { "RPgFwd", "LPgFwd", "Right" } },
event = "GotoViewRel",
args = 1,
}
self.key_events.GotoPrevView = {
{ { "RPgBack", "LPgBack", "Left" } },
doc = "go to previous view",
event = "GotoViewRel", args = -1,
event = "GotoViewRel",
args = -1,
}
end
if Device:hasDPad() then
self.key_events.MoveUp = {
{ "Up" },
doc = "move view up",
event = "Panning", args = {0, -1},
event = "Panning",
args = {0, -1},
}
self.key_events.MoveDown = {
{ "Down" },
doc = "move view down",
event = "Panning", args = {0, 1},
event = "Panning",
args = {0, 1},
}
end
if Device:hasKeyboard() then
self.key_events.GotoFirst = {
{"1"}, doc = "go to start", event = "GotoPercent", args = 0,
{ "1" },
event = "GotoPercent",
args = 0,
}
self.key_events.Goto11 = {
{"2"}, doc = "go to 11%", event = "GotoPercent", args = 11,
{ "2" },
event = "GotoPercent",
args = 11,
}
self.key_events.Goto22 = {
{"3"}, doc = "go to 22%", event = "GotoPercent", args = 22,
{ "3" },
event = "GotoPercent",
args = 22,
}
self.key_events.Goto33 = {
{"4"}, doc = "go to 33%", event = "GotoPercent", args = 33,
{ "4" },
event = "GotoPercent",
args = 33,
}
self.key_events.Goto44 = {
{"5"}, doc = "go to 44%", event = "GotoPercent", args = 44,
{ "5" },
event = "GotoPercent",
args = 44,
}
self.key_events.Goto55 = {
{"6"}, doc = "go to 55%", event = "GotoPercent", args = 55,
{ "6" },
event = "GotoPercent",
args = 55,
}
self.key_events.Goto66 = {
{"7"}, doc = "go to 66%", event = "GotoPercent", args = 66,
{ "7" },
event = "GotoPercent",
args = 66,
}
self.key_events.Goto77 = {
{"8"}, doc = "go to 77%", event = "GotoPercent", args = 77,
{ "8" },
event = "GotoPercent",
args = 77,
}
self.key_events.Goto88 = {
{"9"}, doc = "go to 88%", event = "GotoPercent", args = 88,
{ "9" },
event = "GotoPercent",
args = 88,
}
self.key_events.GotoLast = {
{"0"}, doc = "go to end", event = "GotoPercent", args = 100,
{ "0" },
event = "GotoPercent",
args = 100,
}
end
self.pan_interval = time.s(1 / self.pan_rate)
@@ -311,7 +331,8 @@ function ReaderRolling:onReaderReady()
end
function ReaderRolling:setupTouchZones()
self.ges_events = {}
-- delegate gesture listener to readerui
self.ges_events = nil
self.onGesture = nil
if not Device:isTouchDevice() then return end