diff options
author | Paul Gardiner <paul@glidos.net> | 2012-05-08 12:35:00 +0100 |
---|---|---|
committer | Paul Gardiner <paul@glidos.net> | 2012-05-08 12:35:00 +0100 |
commit | 50b0de6e463ebd954b1a97a2cd093731335f1671 (patch) | |
tree | 9a632a6a346a8d4c941f636ca5fcf2ffb2e6bf0c /pdf/pdf_annot.c | |
parent | 6a6d2016149c731dfa3a485b1bf0b46d7127681d (diff) | |
download | mupdf-50b0de6e463ebd954b1a97a2cd093731335f1671.tar.xz |
Forms: handle field appearance change on mouse up/down
Diffstat (limited to 'pdf/pdf_annot.c')
-rw-r--r-- | pdf/pdf_annot.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index 3864c62e..5b08990f 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -352,7 +352,7 @@ pdf_transform_annot(pdf_annot *annot) } pdf_annot * -pdf_load_annots(pdf_document *xref, pdf_obj *annots) +pdf_load_annots(pdf_document *xref, pdf_obj *annots, fz_matrix page_ctm) { pdf_annot *annot, *head, *tail; pdf_obj *obj, *ap, *as, *n, *rect; @@ -373,7 +373,19 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots) as = pdf_dict_gets(obj, "AS"); if (pdf_is_dict(ap)) { - n = pdf_dict_gets(ap, "N"); /* normal state */ + pdf_hotspot *hp = &xref->hotspot; + + n = NULL; + + if (hp->num == pdf_to_num(obj) + && hp->gen == pdf_to_gen(obj) + && (hp->state & HOTSPOT_POINTER_DOWN)) + { + n = pdf_dict_gets(ap, "D"); /* down state */ + } + + if (n == NULL) + n = pdf_dict_gets(ap, "N"); /* normal state */ /* lookup current state in sub-dictionary */ if (!pdf_is_stream(xref, pdf_to_num(n), pdf_to_gen(n))) @@ -394,6 +406,7 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots) annot = fz_malloc_struct(ctx, pdf_annot); annot->obj = pdf_keep_obj(obj); annot->rect = pdf_to_rect(ctx, rect); + annot->pagerect = fz_transform_rect(page_ctm, annot->rect); annot->ap = form; annot->next = NULL; |