diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj index b23f7ebd12..e09d4cf0e9 100644 --- a/src/pyj/read_book/paged_mode.pyj +++ b/src/pyj/read_book/paged_mode.pyj @@ -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): diff --git a/src/pyj/read_book/prefs/scrolling.pyj b/src/pyj/read_book/prefs/scrolling.pyj index 8ee8eb60a3..be6a221d1e 100644 --- a/src/pyj/read_book/prefs/scrolling.pyj +++ b/src/pyj/read_book/prefs/scrolling.pyj @@ -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'))) diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index 60d1ca7cba..ab846cb196 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -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' diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 82d67f4825..f9fb298560 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -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'), diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index 056e575408..d8eff3e72c 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -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,