mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
E-book viewer: Fix next page skipping the bottom of chapters when the content is wider than the window. Fixes #8153 (Viewer in 0.7.36 cutting off end of chapters.)
This commit is contained in:
parent
6a40732711
commit
32c1ef8ef6
@ -449,7 +449,7 @@ class Document(QWebPage): # {{{
|
|||||||
return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results
|
return self.mainFrame().contentsSize().width() # offsetWidth gives inaccurate results
|
||||||
|
|
||||||
def set_bottom_padding(self, amount):
|
def set_bottom_padding(self, amount):
|
||||||
s = QSize(-1, -1) if amount == 0 else QSize(self.width,
|
s = QSize(-1, -1) if amount == 0 else QSize(self.viewportSize().width(),
|
||||||
self.height+amount)
|
self.height+amount)
|
||||||
self.setPreferredContentsSize(s)
|
self.setPreferredContentsSize(s)
|
||||||
|
|
||||||
@ -820,6 +820,7 @@ class DocumentView(QWebView): # {{{
|
|||||||
self.flipper.initialize(self.current_page_image())
|
self.flipper.initialize(self.current_page_image())
|
||||||
self.manager.next_document()
|
self.manager.next_document()
|
||||||
return
|
return
|
||||||
|
#oheight = self.document.height
|
||||||
lower_limit = opos + delta_y # Max value of top y co-ord after scrolling
|
lower_limit = opos + delta_y # Max value of top y co-ord after scrolling
|
||||||
max_y = self.document.height - window_height # The maximum possible top y co-ord
|
max_y = self.document.height - window_height # The maximum possible top y co-ord
|
||||||
if max_y < lower_limit:
|
if max_y < lower_limit:
|
||||||
@ -835,6 +836,7 @@ class DocumentView(QWebView): # {{{
|
|||||||
if epf:
|
if epf:
|
||||||
self.flipper.initialize(self.current_page_image())
|
self.flipper.initialize(self.current_page_image())
|
||||||
#print 'Document height:', self.document.height
|
#print 'Document height:', self.document.height
|
||||||
|
#print 'Height change:', (self.document.height - oheight)
|
||||||
max_y = self.document.height - window_height
|
max_y = self.document.height - window_height
|
||||||
lower_limit = min(max_y, lower_limit)
|
lower_limit = min(max_y, lower_limit)
|
||||||
#print 'Scroll to:', lower_limit
|
#print 'Scroll to:', lower_limit
|
||||||
@ -842,6 +844,7 @@ class DocumentView(QWebView): # {{{
|
|||||||
self.document.scroll_to(self.document.xpos, lower_limit)
|
self.document.scroll_to(self.document.xpos, lower_limit)
|
||||||
actually_scrolled = self.document.ypos - opos
|
actually_scrolled = self.document.ypos - opos
|
||||||
#print 'After scroll pos:', self.document.ypos
|
#print 'After scroll pos:', self.document.ypos
|
||||||
|
#print 'Scrolled by:', self.document.ypos - opos
|
||||||
self.find_next_blank_line(window_height - actually_scrolled)
|
self.find_next_blank_line(window_height - actually_scrolled)
|
||||||
#print 'After blank line pos:', self.document.ypos
|
#print 'After blank line pos:', self.document.ypos
|
||||||
if epf:
|
if epf:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user