From 7b1ae4e486b9a920c0553cd654adc08668265116 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Thu, 20 Feb 2020 17:00:32 -0500 Subject: [PATCH] continuous: do not limit visible area to page area (#5885) in scroll_mode allow visible area to be larger than one page allows proper scrolling om tall aspect ratios. Fixes #5876 --- frontend/apps/reader/modules/readerview.lua | 6 ++++-- spec/unit/readerlink_spec.lua | 10 +++++----- spec/unit/readerview_spec.lua | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index 74285311b..c57f848c2 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -575,8 +575,10 @@ function ReaderView:recalculate() self.visible_area.x = self.page_area.x + self.page_area.w - self.visible_area.w self.visible_area.y = self.page_area.y end - -- and recalculate it according to page size - self.visible_area:offsetWithin(self.page_area, 0, 0) + if not self.page_scroll then + -- and recalculate it according to page size + self.visible_area:offsetWithin(self.page_area, 0, 0) + end -- clear dim area self.dim_area.w = 0 self.dim_area.h = 0 diff --git a/spec/unit/readerlink_spec.lua b/spec/unit/readerlink_spec.lua index 8b91a83db..7020b24dc 100644 --- a/spec/unit/readerlink_spec.lua +++ b/spec/unit/readerlink_spec.lua @@ -44,7 +44,7 @@ describe("ReaderLink module", function() readerui:handleEvent(Event:new("SetZoomMode", "page")) readerui.paging:onGotoPage(1) assert.is.same(1, readerui.paging.current_page) - readerui.link:onTap(nil, {pos = {x = 250, y = 534}}) + readerui.link:onTap(nil, {pos = {x = 228, y = 534}}) UIManager:run() -- its really hard to get the exact page number in scroll mode -- page positions may have unexpected impact on page number @@ -87,7 +87,7 @@ describe("ReaderLink module", function() readerui:handleEvent(Event:new("SetZoomMode", "page")) readerui.paging:onGotoPage(1) assert.is.same(1, readerui.paging.current_page) - readerui.link:onTap(nil, {pos = {x = 250, y = 534}}) + readerui.link:onTap(nil, {pos = {x = 228, y = 534}}) UIManager:run() assert.truthy(readerui.paging.current_page == 21 or readerui.paging.current_page == 20) @@ -100,7 +100,7 @@ describe("ReaderLink module", function() local expected_page_states = { { gamma = 1, - offset = {x = 17, y = 0}, + offset = {x = 0, y = 0}, page = 3, page_area = { x = 0, y = 0, @@ -115,7 +115,7 @@ describe("ReaderLink module", function() }, { gamma = 1, - offset = {x = 17, y = 0}, + offset = {x = 0, y = 0}, page = 4, page_area = { h = 800, w = 566, @@ -161,7 +161,7 @@ describe("ReaderLink module", function() assert.is.same(4, readerui.paging.current_page) assert.are.same(expected_page_states, readerui.view.page_states) - readerui.link:onTap(nil, {pos = {x = 181, y = 366}}) + readerui.link:onTap(nil, {pos = {x = 164, y = 366}}) UIManager:run() assert.is.same(22, readerui.paging.current_page) readerui.link:onGoBackLink() diff --git a/spec/unit/readerview_spec.lua b/spec/unit/readerview_spec.lua index d82e67bd6..a7bfd6d7d 100644 --- a/spec/unit/readerview_spec.lua +++ b/spec/unit/readerview_spec.lua @@ -115,7 +115,7 @@ describe("Readerview module", function() local saved_ctx = { { gamma = 1, - offset = {x = 17, y = 0}, + offset = {x = 0, y = 0}, page = 1, page_area = { h = 800,