mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use 0 instead of auto for automatic pagination value of cols per screen
This commit is contained in:
parent
63bac0b459
commit
51b940dad9
@ -106,15 +106,14 @@ def layout(is_single_page):
|
|||||||
nonlocal _in_paged_mode, col_width, col_and_gap, screen_height, gap, screen_width, is_full_screen_layout, cols_per_screen
|
nonlocal _in_paged_mode, col_width, col_and_gap, screen_height, gap, screen_width, is_full_screen_layout, cols_per_screen
|
||||||
body_style = window.getComputedStyle(document.body)
|
body_style = window.getComputedStyle(document.body)
|
||||||
first_layout = not _in_paged_mode
|
first_layout = not _in_paged_mode
|
||||||
cps = opts.columns_per_screen
|
cps = opts.columns_per_screen or {}
|
||||||
cps = cps.landscape if window.innerWidth > window.innerHeight else cps.portrait
|
cps = cps.landscape if window.innerWidth > window.innerHeight else cps.portrait
|
||||||
if cps is 'auto':
|
try:
|
||||||
|
cps = int(cps)
|
||||||
|
except:
|
||||||
|
cps = 0
|
||||||
|
if not cps:
|
||||||
cps = int(Math.floor(window.innerWidth / 500.0))
|
cps = int(Math.floor(window.innerWidth / 500.0))
|
||||||
else:
|
|
||||||
try:
|
|
||||||
cps = int(cps)
|
|
||||||
except:
|
|
||||||
cps = 1
|
|
||||||
cps = max(1, min(cps or 1, 20))
|
cps = max(1, min(cps or 1, 20))
|
||||||
if first_layout:
|
if first_layout:
|
||||||
handle_rtl_body(body_style)
|
handle_rtl_body(body_style)
|
||||||
|
@ -6,7 +6,7 @@ opts = {}
|
|||||||
|
|
||||||
def apply_settings(settings):
|
def apply_settings(settings):
|
||||||
settings = settings or {}
|
settings = settings or {}
|
||||||
opts.columns_per_screen = settings.columns_per_screen or {'portrait':'auto', 'landscape':'auto'}
|
opts.columns_per_screen = settings.columns_per_screen or {'portrait':0, 'landscape':0}
|
||||||
opts.margin_left = max(0, settings.margin_left or 0)
|
opts.margin_left = max(0, settings.margin_left or 0)
|
||||||
opts.margin_right = max(0, settings.margin_right or 0)
|
opts.margin_right = max(0, settings.margin_right or 0)
|
||||||
opts.color_scheme = settings.color_scheme
|
opts.color_scheme = settings.color_scheme
|
||||||
|
@ -25,7 +25,7 @@ defaults = {
|
|||||||
'read_mode': 'paged',
|
'read_mode': 'paged',
|
||||||
'max_text_height': 0,
|
'max_text_height': 0,
|
||||||
'max_text_width': 0,
|
'max_text_width': 0,
|
||||||
'columns_per_screen': {'portrait':'auto', 'landscape':'auto'},
|
'columns_per_screen': {'portrait':0, 'landscape':0},
|
||||||
'current_color_scheme': 'white',
|
'current_color_scheme': 'white',
|
||||||
'user_color_schemes': {},
|
'user_color_schemes': {},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user