mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Reset paged mode globals when loading new flow
This commit is contained in:
parent
658865e5ed
commit
2805e0b84b
@ -21,7 +21,7 @@ from read_book.paged_mode import (
|
||||
onwheel as paged_onwheel, onkeydown as paged_onkeydown, scroll_to_elem,
|
||||
jump_to_cfi as paged_jump_to_cfi, handle_gesture as paged_handle_gesture,
|
||||
scroll_by_page as paged_scroll_by_page, anchor_funcs as paged_anchor_funcs,
|
||||
snap_to_selection
|
||||
snap_to_selection, reset_paged_mode_globals
|
||||
)
|
||||
from read_book.settings import apply_settings, opts
|
||||
from read_book.touch import create_handlers as create_touch_handlers
|
||||
@ -112,6 +112,7 @@ class IframeBoss:
|
||||
self.book = current_book.book = data.book
|
||||
spine = self.book.manifest.spine
|
||||
index = spine.indexOf(data.name)
|
||||
reset_paged_mode_globals()
|
||||
set_layout_mode('flow' if FORCE_FLOW_MODE else data.settings.read_mode)
|
||||
if current_layout_mode() is 'flow':
|
||||
self.do_layout = flow_layout
|
||||
|
@ -52,6 +52,11 @@ def in_paged_mode():
|
||||
col_width = screen_width = screen_height = cols_per_screen = gap = col_and_gap = 0
|
||||
is_full_screen_layout = False
|
||||
|
||||
def reset_paged_mode_globals():
|
||||
nonlocal _in_paged_mode, col_width, col_and_gap, screen_height, gap, screen_width, is_full_screen_layout, cols_per_screen
|
||||
col_width = screen_width = screen_height = cols_per_screen = gap = col_and_gap = 0
|
||||
is_full_screen_layout = _in_paged_mode = False
|
||||
|
||||
def column_at(xpos):
|
||||
# Return the (zero-based) number of the column that contains xpos
|
||||
sw = document.body.scrollWidth
|
||||
|
Loading…
x
Reference in New Issue
Block a user