summaryrefslogtreecommitdiff
path: root/platform/gl
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-06-26 14:45:15 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-07-04 17:23:21 +0200
commit1f787e13a6c75cf12a09fc44d590ba9169c52a71 (patch)
treee22d92e99290f40600044137ecd494e335352cda /platform/gl
parentb064110f9640e19e7c582ad7aa227ea03ac07fe7 (diff)
downloadmupdf-1f787e13a6c75cf12a09fc44d590ba9169c52a71.tar.xz
Add fz_snap_selection function to snap selection to chars/words/lines.
Updates the input point coordinates, and also returns a quad with appropriate UI handles.
Diffstat (limited to 'platform/gl')
-rw-r--r--platform/gl/gl-main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 726de1c0..ee182cdd 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -489,6 +489,11 @@ static void do_page_selection(void)
fz_transform_point(&page_a, &view_page_inv_ctm);
fz_transform_point(&page_b, &view_page_inv_ctm);
+ if (ui.mod == GLUT_ACTIVE_CTRL)
+ fz_snap_selection(ctx, page_text, &page_a, &page_b, FZ_SELECT_WORDS);
+ else if (ui.mod == GLUT_ACTIVE_CTRL + GLUT_ACTIVE_SHIFT)
+ fz_snap_selection(ctx, page_text, &page_a, &page_b, FZ_SELECT_LINES);
+
n = fz_highlight_selection(ctx, page_text, page_a, page_b, hits, nelem(hits));
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); /* invert destination color */