[FocusManager] correct cursor keys in RTL (#13362)
Some checks failed
macos / macOS 13 x86-64 🔨15.2 🎯10.15 (push) Has been cancelled
macos / macOS 14 ARM64 🔨15.4 🎯11.0 (push) Has been cancelled

This commit is contained in:
David
2025-04-10 22:42:48 +01:00
committed by GitHub
parent d6771ebe61
commit 3def243f97
3 changed files with 35 additions and 15 deletions

View File

@@ -51,19 +51,21 @@ end
function ReaderPaging:onGesture() end
function ReaderPaging:registerKeyEvents()
local nextKey = BD.mirroredUILayout() and "Left" or "Right"
local prevKey = BD.mirroredUILayout() and "Right" or "Left"
if Device:hasDPad() and Device:useDPadAsActionKeys() then
if G_reader_settings:isTrue("left_right_keys_turn_pages") then
self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", "Right", " " } }, event = "GotoViewRel", args = 1, }
self.key_events.GotoPrevPage = { { { "RPgBack", "LPgBack", "Left" } }, event = "GotoViewRel", args = -1, }
self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", nextKey, " " } }, event = "GotoViewRel", args = 1, }
self.key_events.GotoPrevPage = { { { "RPgBack", "LPgBack", prevKey } }, event = "GotoViewRel", args = -1, }
elseif G_reader_settings:nilOrFalse("left_right_keys_turn_pages") then
self.key_events.GotoNextChapter = { { "Right" }, event = "GotoNextChapter", args = 1, }
self.key_events.GotoPrevChapter = { { "Left" }, event = "GotoPrevChapter", args = -1, }
self.key_events.GotoNextChapter = { { nextKey }, event = "GotoNextChapter", args = 1, }
self.key_events.GotoPrevChapter = { { prevKey }, event = "GotoPrevChapter", args = -1, }
self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", " " } }, event = "GotoViewRel", args = 1, }
self.key_events.GotoPrevPage = { { { "RPgBack", "LPgBack" } }, event = "GotoViewRel", args = -1, }
end
elseif Device:hasKeys() then
self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", not Device:hasFewKeys() and "Right" } }, event = "GotoViewRel", args = 1, }
self.key_events.GotoPrevPage = { { { "RPgBack", "LPgBack", not Device:hasFewKeys() and "Left" } }, event = "GotoViewRel", args = -1, }
self.key_events.GotoNextPage = { { { "RPgFwd", "LPgFwd", not Device:hasFewKeys() and nextKey } }, event = "GotoViewRel", args = 1, }
self.key_events.GotoPrevPage = { { { "RPgBack", "LPgBack", not Device:hasFewKeys() and prevKey } }, event = "GotoViewRel", args = -1, }
self.key_events.GotoNextPos = { { "Down" }, event = "GotoPosRel", args = 1, }
self.key_events.GotoPrevPos = { { "Up" }, event = "GotoPosRel", args = -1, }
end