From 0872338ae7c970cfdcf6976f607c0cf5ed287776 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Apr 2020 20:37:45 +0530 Subject: [PATCH] Viewer: Add an option to have taps turn by screenfulls instead of pages, under Scrolling behavior --- src/pyj/read_book/paged_mode.pyj | 4 ++-- src/pyj/read_book/prefs/scrolling.pyj | 4 +++- src/pyj/read_book/settings.pyj | 1 + src/pyj/read_book/view.pyj | 1 + src/pyj/session.pyj | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj index b2a5d968f0..d03accde4a 100644 --- a/src/pyj/read_book/paged_mode.pyj +++ b/src/pyj/read_book/paged_mode.pyj @@ -627,9 +627,9 @@ def handle_gesture(gesture): if not gesture.active or gesture.is_held: scroll_by_page(gesture.direction is 'right', True) elif gesture.type is 'prev-page': - scroll_by_page(True, False) + scroll_by_page(True, opts.paged_taps_scroll_by_screen) elif gesture.type is 'next-page': - scroll_by_page(False, False) + scroll_by_page(False, opts.paged_taps_scroll_by_screen) elif gesture.type is 'long-tap': r = word_at_point(gesture.viewport_x, gesture.viewport_y) if r: diff --git a/src/pyj/read_book/prefs/scrolling.pyj b/src/pyj/read_book/prefs/scrolling.pyj index 71a6511eb6..8ee8eb60a3 100644 --- a/src/pyj/read_book/prefs/scrolling.pyj +++ b/src/pyj/read_book/prefs/scrolling.pyj @@ -63,11 +63,13 @@ def create_scrolling_panel(container, apply_func, cancel_func): ans.valueAsNumber = sd.get(name, defaults[name]) return E.label("for"=name, text), ans - container.appendChild(E.div(style='margin-top:1ex', _('Control how mouse based scrolling works in paged mode'))) + container.appendChild(E.div(style='margin-top:1ex', _('Control how scrolling works in paged mode'))) container.appendChild(cb( 'paged_wheel_scrolls_by_screen', _('Mouse wheel scrolls by screen fulls instead of pages'))) container.appendChild(cb( '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.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 8d4a92222f..35526b39f3 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -24,6 +24,7 @@ def update_settings(settings): opts.margin_right = max(0, settings.margin_right) opts.override_book_colors = settings.override_book_colors opts.paged_wheel_scrolls_by_screen = v'!!settings.paged_wheel_scrolls_by_screen' + 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' opts.user_stylesheet = settings.user_stylesheet diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 4ead044d8a..aaf565cb40 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -840,6 +840,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_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'), 'scroll_auto_boundary_delay': sd.get('scroll_auto_boundary_delay'), diff --git a/src/pyj/session.pyj b/src/pyj/session.pyj index 6edb6ad6f3..056e575408 100644 --- a/src/pyj/session.pyj +++ b/src/pyj/session.pyj @@ -50,6 +50,7 @@ defaults = { 'override_book_colors': 'never', 'paged_margin_clicks_scroll_by_screen': True, 'paged_wheel_scrolls_by_screen': False, + 'paged_taps_scroll_by_screen': False, 'read_mode': 'paged', 'scroll_auto_boundary_delay': 5, 'scroll_stop_boundaries': False,