From 84c0c62018110e0cbb01d30d4df96b64e0b6899f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 11 Jul 2018 14:24:19 +0200 Subject: Respect NoRotate flag for icon-based annotations. --- platform/gl/gl-annotate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'platform') diff --git a/platform/gl/gl-annotate.c b/platform/gl/gl-annotate.c index aa40cc51..265ab673 100644 --- a/platform/gl/gl-annotate.c +++ b/platform/gl/gl-annotate.c @@ -115,6 +115,8 @@ static void new_annot(int type) case PDF_ANNOT_SOUND: { fz_rect icon_rect = { 12, 12, 12+20, 12+20 }; + pdf_set_annot_flags(ctx, selected_annot, + PDF_ANNOT_IS_PRINT | PDF_ANNOT_IS_NO_ZOOM | PDF_ANNOT_IS_NO_ROTATE); pdf_set_annot_rect(ctx, selected_annot, icon_rect); pdf_set_annot_color(ctx, selected_annot, 3, yellow); } @@ -721,10 +723,14 @@ static void do_edit_icon(fz_irect canvas_area, fz_irect area, fz_rect *rect) /* Commit movement on mouse-up */ if (!ui.down) { + fz_point dp = { rect->x0 - start_pt.x, rect->y0 - start_pt.y }; moving = 0; - if (fz_abs(start_pt.x - rect->x0) > 0.1f || fz_abs(start_pt.x - rect->y0) > 0.1f) + if (fz_abs(dp.x) > 0.1f || fz_abs(dp.y) > 0.1f) { - fz_rect trect = fz_transform_rect(*rect, view_page_inv_ctm); + fz_rect trect = pdf_annot_rect(ctx, selected_annot); + dp = fz_transform_vector(dp, view_page_inv_ctm); + trect.x0 += dp.x; trect.x1 += dp.x; + trect.y0 += dp.y; trect.y1 += dp.y; pdf_set_annot_rect(ctx, selected_annot, trect); } } -- cgit v1.2.3