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
reviewable/pr5739/r7
yparitcher 4 years ago committed by GitHub
parent 69f4144dc1
commit 7b1ae4e486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.x = self.page_area.x + self.page_area.w - self.visible_area.w
self.visible_area.y = self.page_area.y self.visible_area.y = self.page_area.y
end end
-- and recalculate it according to page size if not self.page_scroll then
self.visible_area:offsetWithin(self.page_area, 0, 0) -- and recalculate it according to page size
self.visible_area:offsetWithin(self.page_area, 0, 0)
end
-- clear dim area -- clear dim area
self.dim_area.w = 0 self.dim_area.w = 0
self.dim_area.h = 0 self.dim_area.h = 0

@ -44,7 +44,7 @@ describe("ReaderLink module", function()
readerui:handleEvent(Event:new("SetZoomMode", "page")) readerui:handleEvent(Event:new("SetZoomMode", "page"))
readerui.paging:onGotoPage(1) readerui.paging:onGotoPage(1)
assert.is.same(1, readerui.paging.current_page) 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() UIManager:run()
-- its really hard to get the exact page number in scroll mode -- its really hard to get the exact page number in scroll mode
-- page positions may have unexpected impact on page number -- page positions may have unexpected impact on page number
@ -87,7 +87,7 @@ describe("ReaderLink module", function()
readerui:handleEvent(Event:new("SetZoomMode", "page")) readerui:handleEvent(Event:new("SetZoomMode", "page"))
readerui.paging:onGotoPage(1) readerui.paging:onGotoPage(1)
assert.is.same(1, readerui.paging.current_page) 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() UIManager:run()
assert.truthy(readerui.paging.current_page == 21 assert.truthy(readerui.paging.current_page == 21
or readerui.paging.current_page == 20) or readerui.paging.current_page == 20)
@ -100,7 +100,7 @@ describe("ReaderLink module", function()
local expected_page_states = { local expected_page_states = {
{ {
gamma = 1, gamma = 1,
offset = {x = 17, y = 0}, offset = {x = 0, y = 0},
page = 3, page = 3,
page_area = { page_area = {
x = 0, y = 0, x = 0, y = 0,
@ -115,7 +115,7 @@ describe("ReaderLink module", function()
}, },
{ {
gamma = 1, gamma = 1,
offset = {x = 17, y = 0}, offset = {x = 0, y = 0},
page = 4, page = 4,
page_area = { page_area = {
h = 800, w = 566, h = 800, w = 566,
@ -161,7 +161,7 @@ describe("ReaderLink module", function()
assert.is.same(4, readerui.paging.current_page) assert.is.same(4, readerui.paging.current_page)
assert.are.same(expected_page_states, readerui.view.page_states) 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() UIManager:run()
assert.is.same(22, readerui.paging.current_page) assert.is.same(22, readerui.paging.current_page)
readerui.link:onGoBackLink() readerui.link:onGoBackLink()

@ -115,7 +115,7 @@ describe("Readerview module", function()
local saved_ctx = { local saved_ctx = {
{ {
gamma = 1, gamma = 1,
offset = {x = 17, y = 0}, offset = {x = 0, y = 0},
page = 1, page = 1,
page_area = { page_area = {
h = 800, h = 800,

Loading…
Cancel
Save