[UX] Next/Previous Bookmark Gestures (#5968)

Fixes #5965
This commit is contained in:
yparitcher
2020-03-16 11:52:09 -04:00
committed by GitHub
parent 4a5a2eb708
commit 08359ee1b6
6 changed files with 39 additions and 55 deletions

View File

@@ -28,6 +28,8 @@ local action_strings = {
page_jmp_fwd_1 = _("Next page"),
prev_chapter = _("Previous chapter"),
next_chapter = _("Next chapter"),
prev_bookmark = _("Previous bookmark"),
next_bookmark = _("Next bookmark"),
go_to = _("Go to"),
skim = _("Skim"),
back = _("Back"),
@@ -702,6 +704,8 @@ function ReaderGesture:buildMenu(ges, default)
{"page_jmp_fwd_1", not self.is_docless},
{"prev_chapter", not self.is_docless},
{"next_chapter", not self.is_docless},
{"prev_bookmark", not self.is_docless},
{"next_bookmark", not self.is_docless},
{"go_to", true},
{"skim", not self.is_docless},
{"back", true},
@@ -1300,6 +1304,10 @@ function ReaderGesture:gestureAction(action, ges)
self.ui:handleEvent(Event:new("GotoNextChapter"))
elseif action == "prev_chapter" then
self.ui:handleEvent(Event:new("GotoPrevChapter"))
elseif action == "next_bookmark" then
self.ui:handleEvent(Event:new("GotoNextBookmarkFromPage"))
elseif action == "prev_bookmark" then
self.ui:handleEvent(Event:new("GotoPreviousBookmarkFromPage"))
elseif action == "go_to" then
self.ui:handleEvent(Event:new("ShowGotoDialog"))
elseif action == "skim" then
@@ -1564,12 +1572,7 @@ function ReaderGesture:multiswipeAction(multiswipe_directions, ges)
end
function ReaderGesture:pageUpdate(page)
local curr_page
if self.document.info.has_pages then
curr_page = self.ui.paging.current_page
else
curr_page = self.document:getCurrentPage()
end
local curr_page = self.ui:getCurrentPage()
if curr_page and page then
curr_page = curr_page + page
self.ui:handleEvent(Event:new("GotoPage", curr_page))