diff --git a/frontend/apps/reader/skimtowidget.lua b/frontend/apps/reader/skimtowidget.lua index 78a0d225f..f69270987 100644 --- a/frontend/apps/reader/skimtowidget.lua +++ b/frontend/apps/reader/skimtowidget.lua @@ -243,7 +243,7 @@ function SkimToWidget:init() width = self.button_width, show_parent = self, callback = function() - self.ui:handleEvent(Event:new("GotoNextBookmarkFromPage")) + self:goToByEvent("GotoNextBookmarkFromPage") end, hold_callback = function() local page = self.ui.bookmark:getLastBookmarkedPageFromPage(self.ui:getCurrentPage()) @@ -260,7 +260,7 @@ function SkimToWidget:init() width = self.button_width, show_parent = self, callback = function() - self.ui:handleEvent(Event:new("GotoPreviousBookmarkFromPage")) + self:goToByEvent("GotoPreviousBookmarkFromPage") end, hold_callback = function() local page = self.ui.bookmark:getFirstBookmarkedPageFromPage(self.ui:getCurrentPage()) @@ -409,6 +409,15 @@ function SkimToWidget:goToBookmark(page) end end +function SkimToWidget:goToByEvent(event_name) + if event_name then + self:addOriginToLocationStack() + self.ui:handleEvent(Event:new(event_name)) + self.curr_page = self.ui:getCurrentPage() + self:update() + end +end + function SkimToWidget:onAnyKeyPressed() UIManager:close(self) return true