Skip to content

Commit ee0939a

Browse files
committed
Add page information to text annotations
1 parent 198e2b4 commit ee0939a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: lisp/pdf-annot.el

+7-3
Original file line numberDiff line numberDiff line change
@@ -1085,8 +1085,8 @@ Return the new annotation."
10851085
(pdf-annot-activate-annotation a))
10861086
a))
10871087

1088-
(defun pdf-annot-add-text-annotation (pos &optional icon property-alist)
1089-
"Add a new text annotation at POS in the selected window.
1088+
(defun pdf-annot-add-text-annotation (pos &optional icon property-alist page)
1089+
"Add a new text annotation at POS on PAGE in the selected window.
10901090
10911091
POS should be a image position object or a cons \(X . Y\), both
10921092
being image coordinates.
@@ -1114,6 +1114,9 @@ Return the new annotation."
11141114
(list posn)))
11151115
(pdf-util-assert-pdf-window)
11161116
(when (posnp pos)
1117+
(setq page (or page
1118+
(when pdf-view-roll-minor-mode
1119+
(1+ (/ (posn-point pos) 4)))))
11171120
(setq pos (posn-object-x-y pos)))
11181121
(let ((isize (pdf-view-image-size))
11191122
(x (car pos))
@@ -1139,7 +1142,8 @@ Return the new annotation."
11391142
pdf-annot-default-text-annotation-properties
11401143
(cdr (assq 'text pdf-annot-default-annotation-properties))
11411144
(cdr (assq t pdf-annot-default-annotation-properties))
1142-
`((color . ,(car pdf-annot-color-history))))))))
1145+
`((color . ,(car pdf-annot-color-history))))
1146+
page))))
11431147

11441148
(defun pdf-annot-mouse-add-text-annotation (ev)
11451149
"Add a text annotation using the mouse.

0 commit comments

Comments
 (0)