mirror of
https://github.com/logseq/logseq.git
synced 2026-05-26 05:34:07 +00:00
fix: wrong bounding coordinates for highlights
This should fix #10400. After a multiline text selection in PDF, the first rectangle in sel-range is a incorrect "noise", not relevant to the selection range. The underlying cause is not clear to me. Note that it's a universal problem when doing mutliline highlights, even though most of the time it does not have any effect on user experience. This commit is a working hotfix. And very possibly there would be a better solution after looking into the update mechanism of the variable `sel-state` used here. But I have no enough experience to dive into this.
This commit is contained in:
@@ -647,6 +647,9 @@
|
||||
hl-fn #(when-let [page-info (pdf-utils/get-page-from-range sel-range)]
|
||||
(when-let [sel-rects (pdf-utils/get-range-rects<-page-cnt sel-range (:page-el page-info))]
|
||||
(let [page (int (:page-number page-info))
|
||||
sel-rects (if (> (count sel-rects) 1)
|
||||
(rest sel-rects)
|
||||
sel-rects)
|
||||
^js bounding (pdf-utils/get-bounding-rect sel-rects)
|
||||
vw-pos {:bounding bounding :rects sel-rects :page page}
|
||||
sc-pos (pdf-utils/vw-to-scaled-pos viewer vw-pos)]
|
||||
|
||||
Reference in New Issue
Block a user