diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2018-08-21 10:05:10 +0100 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2018-08-21 12:09:40 +0100 |
commit | 1a4fc8250f89e316c0a8cdb71fa47dd591255176 (patch) | |
tree | 26d170693ae0027a0fe9d91113039a98f3775d02 | |
parent | 781e6d58b23fc3b18549908fcc4b2163175d42a9 (diff) | |
download | mupdf-1a4fc8250f89e316c0a8cdb71fa47dd591255176.tar.xz |
Choose the lastmost annotation rather than firstmost as mouse event target.
pdf_pass_event iterates through the annotations to find one with a
bounding box that encompasses the event point. We were choosing the first
found, whereas later annotations are considered above earlier ones so we
should be choosing the last found.
-rw-r--r-- | source/pdf/pdf-form.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c index 879c7819..2a7d80b1 100644 --- a/source/pdf/pdf-form.c +++ b/source/pdf/pdf-form.c @@ -532,7 +532,8 @@ int pdf_has_unsaved_changes(fz_context *ctx, pdf_document *doc) int pdf_pass_event(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event) { - pdf_annot *annot; + pdf_annot *a; + pdf_annot *annot = NULL; pdf_hotspot *hp = &doc->hotspot; fz_point *pt = &(ui_event->event.pointer.pt); int changed = 0; @@ -541,12 +542,12 @@ int pdf_pass_event(fz_context *ctx, pdf_document *doc, pdf_page *page, pdf_ui_ev if (page == NULL) return 0; - for (annot = page->annots; annot; annot = annot->next) + for (a = page->annots; a; a = a->next) { - bbox = pdf_bound_annot(ctx, annot); + bbox = pdf_bound_annot(ctx, a); if (pt->x >= bbox.x0 && pt->x <= bbox.x1) if (pt->y >= bbox.y0 && pt->y <= bbox.y1) - break; + annot = a; } /* Skip hidden annotations. */ |