mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Viewer: Add a setting to control how many pixels a scroll wheel should generate before triggering a page turn
This commit is contained in:
parent
26382ef870
commit
4ad884f96c
@ -567,8 +567,7 @@ class HandleWheel:
|
||||
self.last_event_at = now
|
||||
self.last_event_backwards = backward
|
||||
self.accumulated_scroll += deltaY
|
||||
lh = line_height()
|
||||
if self.accumulated_scroll > 5 * lh:
|
||||
if self.accumulated_scroll > opts.paged_pixel_scroll_threshold:
|
||||
self.do_scroll(backward)
|
||||
|
||||
def do_scroll(self, backward):
|
||||
|
@ -70,6 +70,17 @@ def create_scrolling_panel(container, apply_func, cancel_func):
|
||||
'paged_margin_clicks_scroll_by_screen', _('Clicking on the margins scrolls by screen fulls instead of pages')))
|
||||
container.appendChild(cb(
|
||||
'paged_taps_scroll_by_screen', _('Tapping scrolls by screen fulls instead of pages')))
|
||||
container.appendChild(
|
||||
E.div(style='display:grid;margin-top:1ex;align-items:center;grid-template-columns:auto min-content;grid-gap:1ex; max-width: 30em',
|
||||
*spinner(
|
||||
'paged_pixel_scroll_threshold',
|
||||
_('Pixel scroll threshold:'),
|
||||
title=_('When using a touchpad or mouse wheel that produces scroll events in pixels, set the number of pixels before a page turn is triggered'),
|
||||
step=5,
|
||||
min=0,
|
||||
max=1000
|
||||
),
|
||||
))
|
||||
|
||||
container.appendChild(E.hr())
|
||||
container.appendChild(E.div(style='margin-top:1ex', _('Control how smooth scrolling works in flow mode')))
|
||||
|
@ -26,6 +26,7 @@ def update_settings(settings):
|
||||
opts.margin_bottom = max(0, settings.margin_bottom)
|
||||
opts.override_book_colors = settings.override_book_colors
|
||||
opts.paged_wheel_scrolls_by_screen = v'!!settings.paged_wheel_scrolls_by_screen'
|
||||
opts.paged_pixel_scroll_threshold = settings.paged_pixel_scroll_threshold
|
||||
opts.paged_taps_scroll_by_screen = v'!!settings.paged_taps_scroll_by_screen'
|
||||
opts.scroll_auto_boundary_delay = settings.scroll_auto_boundary_delay
|
||||
opts.scroll_stop_boundaries = v'!!settings.scroll_stop_boundaries'
|
||||
|
@ -854,6 +854,7 @@ class View:
|
||||
'hide_tooltips': sd.get('hide_tooltips'),
|
||||
'cover_preserve_aspect_ratio': sd.get('cover_preserve_aspect_ratio'),
|
||||
'paged_wheel_scrolls_by_screen': sd.get('paged_wheel_scrolls_by_screen'),
|
||||
'paged_pixel_scroll_threshold': sd.get('paged_pixel_scroll_threshold'),
|
||||
'paged_taps_scroll_by_screen': sd.get('paged_taps_scroll_by_screen'),
|
||||
'lines_per_sec_auto': sd.get('lines_per_sec_auto'),
|
||||
'lines_per_sec_smooth': sd.get('lines_per_sec_smooth'),
|
||||
|
@ -51,6 +51,7 @@ defaults = {
|
||||
'paged_margin_clicks_scroll_by_screen': True,
|
||||
'paged_wheel_scrolls_by_screen': False,
|
||||
'paged_taps_scroll_by_screen': False,
|
||||
'paged_pixel_scroll_threshold': 60,
|
||||
'read_mode': 'paged',
|
||||
'scroll_auto_boundary_delay': 5,
|
||||
'scroll_stop_boundaries': False,
|
||||
|
Loading…
x
Reference in New Issue
Block a user