[evince/gnome-3-28] libview: Set minimum for Page Forward/Backward scrolling
- From: Jason Crain <jcrain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-28] libview: Set minimum for Page Forward/Backward scrolling
- Date: Tue, 17 Jul 2018 19:52:19 +0000 (UTC)
commit 931415c5ea5df1567798b4ff0ecb99a5136b30a7
Author: Jason Crain <jcrain src gnome org>
Date: Tue Jul 17 11:10:04 2018 -0500
libview: Set minimum for Page Forward/Backward scrolling
Page Forward and Backward scrolling leaves a line of context. It jumps
by the height of the view minus the height of a line of text. But if the
text is very tall, scrolling may not work or may scroll in the wrong
direction.
This sets a minimum height for scrolling. If the line is more than 30%
of the page, the height of the line is ignored and it jumps the full
view height.
Fixes #692
libview/ev-view.c | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 4f116a64..35301c1e 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -107,6 +107,7 @@ typedef struct {
#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
#define SCROLL_TIME 150
+#define SCROLL_PAGE_THRESHOLD 0.7
#define DEFAULT_PIXBUF_CACHE_SIZE 52428800 /* 50MB */
@@ -951,6 +952,10 @@ compute_scroll_increment (EvView *view,
if (cairo_region_num_rectangles (sel_region) > 0) {
cairo_region_get_rectangle (sel_region, 0, &rect);
fraction = 1 - (rect.height / gtk_adjustment_get_page_size (adjustment));
+ /* jump the full page height if the line is too large a
+ * fraction of the page */
+ if (fraction < SCROLL_PAGE_THRESHOLD)
+ fraction = 1.0;
}
cairo_region_destroy (sel_region);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]