From c2a0cc836d2c5f45ee3ee8e033f303dd571b365f Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 5 May 2020 18:50:16 +0200 Subject: [PATCH] [Gesture] Add go to first and last page (#6096) --- frontend/apps/reader/modules/readergesture.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readergesture.lua b/frontend/apps/reader/modules/readergesture.lua index ccdbe4a3c..6af511d53 100644 --- a/frontend/apps/reader/modules/readergesture.lua +++ b/frontend/apps/reader/modules/readergesture.lua @@ -28,6 +28,8 @@ local action_strings = { page_jmp_fwd_1 = _("Next page"), prev_chapter = _("Previous chapter"), next_chapter = _("Next chapter"), + first_page = _("First page"), + last_page = _("Last page"), prev_bookmark = _("Previous bookmark"), next_bookmark = _("Next bookmark"), go_to = _("Go to"), @@ -705,6 +707,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}, + {"first_page", not self.is_docless}, + {"last_page", not self.is_docless}, {"prev_bookmark", not self.is_docless}, {"next_bookmark", not self.is_docless}, {"go_to", true}, @@ -1261,7 +1265,7 @@ end function ReaderGesture:gestureAction(action, ges) if action == "ignore" - or (ges.ges == "hold" and self.ignore_hold_corners) then + or (ges.ges == "hold" and self.ignore_hold_corners) then return elseif action == "reading_progress" and ReaderGesture.getReaderProgress then UIManager:show(ReaderGesture.getReaderProgress()) @@ -1306,6 +1310,12 @@ function ReaderGesture:gestureAction(action, ges) self.ui:handleEvent(Event:new("GotoViewRel", -1)) elseif action == "next_chapter" then self.ui:handleEvent(Event:new("GotoNextChapter")) + elseif action == "first_page" then + self.ui:handleEvent(Event:new("GotoPage", 1)) + elseif action == "last_page" then + if self.view.document then + self.ui:handleEvent(Event:new("GotoPage", self.view.document:getPageCount())) + end elseif action == "prev_chapter" then self.ui:handleEvent(Event:new("GotoPrevChapter")) elseif action == "next_bookmark" then