[gs-commits] mupdf 1.16.1.12 Bug 701402: Add 5% slop to smart scrollin

[email protected] (Tor Andersson)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
commit 77c591b24ca641d6e28c9e4810b00f3602cb45fc
Author: Tor Andersson <[email protected]>
Date:   Wed Aug 14 14:02:33 2019 +0200

    Bug 701402: Add 5% slop to smart scrolling.
    
    If the scroll would only take you 5% across the page, skip directly to
    the next page instead.

diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 332974f..8396bfe 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -1121,9 +1121,11 @@ static void auto_zoom(void)
 
 static void smart_move_backward(void)
 {
-	if (scroll_y <= 0)
+	int slop_x = page_tex.w / 20;
+	int slop_y = page_tex.h / 20;
+	if (scroll_y <= slop_y)
 	{
-		if (scroll_x <= 0)
+		if (scroll_x <= slop_x)
 		{
 			if (currentpage - 1 >= 0)
 			{
@@ -1146,9 +1148,11 @@ static void smart_move_backward(void)
 
 static void smart_move_forward(void)
 {
-	if (scroll_y + canvas_h >= page_tex.h)
+	int slop_x = page_tex.w / 20;
+	int slop_y = page_tex.h / 20;
+	if (scroll_y + canvas_h >= page_tex.h - slop_y)
 	{
-		if (scroll_x + canvas_w >= page_tex.w)
+		if (scroll_x + canvas_w >= page_tex.w - slop_x)
 		{
 			if (currentpage + 1 < fz_count_pages(ctx, doc))
 			{
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index ee416e0..7293169 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -1472,9 +1472,9 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers)
 		break;
 
 	case 'b':
-		if (app->pany >= 0)
+		if (app->pany >= -app->imgh/20)
 		{
-			if (app->panx >= 0)
+			if (app->panx >= -app->imgw/20)
 			{
 				if (app->pageno - 1 > 0)
 				{
@@ -1499,9 +1499,9 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers)
 		break;
 
 	case ' ':
-		if (app->imgh + app->pany <= app->winh)
+		if (app->imgh + app->pany <= app->winh + app->imgh/20)
 		{
-			if (app->imgw + app->panx <= app->winw)
+			if (app->imgw + app->panx <= app->winw + app->imgw/20)
 			{
 				if (app->pageno + 1 <= app->pagecount)
 				{

http://git.ghostscript.com/?p=mupdf.git;a=commit;h=77c591b24ca641d6e28c9e4810b00f3602cb45fc

--
MuPDF library
Artifex Software, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.