mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: When displaying multiple pages per screen fix whole screen scrolling so that it works as expected even at the end of the file, when their might be fewer pages left than would fill the screen.
This commit is contained in:
parent
929ba65820
commit
76f1582757
Binary file not shown.
@ -32,6 +32,19 @@ has_start_text = (elem) ->
|
|||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
create_page_div = (elem) ->
|
||||||
|
div = document.createElement('div')
|
||||||
|
div.innerText = ' \n '
|
||||||
|
div.setAttribute('data-calibre-dummy-page', '1')
|
||||||
|
document.body.appendChild(div)
|
||||||
|
div.style.setProperty('-webkit-column-break-before', 'always')
|
||||||
|
div.style.setProperty('white-space', 'pre')
|
||||||
|
div.style.setProperty('background-color', 'transparent')
|
||||||
|
div.style.setProperty('background-image', 'none')
|
||||||
|
div.style.setProperty('border-width', '0')
|
||||||
|
div.style.setProperty('float', 'none')
|
||||||
|
div.style.setProperty('position', 'static')
|
||||||
|
|
||||||
class PagedDisplay
|
class PagedDisplay
|
||||||
# This class is a namespace to expose functions via the
|
# This class is a namespace to expose functions via the
|
||||||
# window.paged_display object. The most important functions are:
|
# window.paged_display object. The most important functions are:
|
||||||
@ -125,6 +138,11 @@ class PagedDisplay
|
|||||||
single_screen = (document.body.scrollHeight < window.innerHeight + 75)
|
single_screen = (document.body.scrollHeight < window.innerHeight + 75)
|
||||||
this.handle_rtl_body(body_style)
|
this.handle_rtl_body(body_style)
|
||||||
first_layout = true
|
first_layout = true
|
||||||
|
if not single_screen and this.cols_per_screen > 1
|
||||||
|
num = this.cols_per_screen - 1
|
||||||
|
while num > 0
|
||||||
|
num -= 1
|
||||||
|
create_page_div()
|
||||||
|
|
||||||
ww = window.innerWidth
|
ww = window.innerWidth
|
||||||
|
|
||||||
@ -434,6 +452,11 @@ class PagedDisplay
|
|||||||
return -1
|
return -1
|
||||||
cc = this.current_column_location()
|
cc = this.current_column_location()
|
||||||
ans = cc + this.screen_width
|
ans = cc + this.screen_width
|
||||||
|
if this.cols_per_screen > 1
|
||||||
|
width_left = document.body.scrollWidth - (window.pageXOffset + window.innerWidth)
|
||||||
|
pages_left = width_left / this.page_width
|
||||||
|
if pages_left < this.cols_per_screen
|
||||||
|
return -1 # Only blank, dummy pages left
|
||||||
limit = document.body.scrollWidth - window.innerWidth
|
limit = document.body.scrollWidth - window.innerWidth
|
||||||
if ans > limit
|
if ans > limit
|
||||||
ans = if window.pageXOffset < limit then limit else -1
|
ans = if window.pageXOffset < limit then limit else -1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user