enhance(pdf): remove invalid highlight selection range rects

This commit is contained in:
charlie
2023-11-02 12:08:31 +08:00
committed by Andelf
parent c55c25d3ca
commit 9e9ae5c6f4
2 changed files with 2 additions and 4 deletions

View File

@@ -145,7 +145,8 @@
^js cnt-offset (.getBoundingClientRect page-cnt)]
(when (seq rge-rects)
(let [rects (for [rect rge-rects]
(let [rects (for [rect rge-rects
:when (and rect (not (zero? (.-width rect))) (not (zero? (.-height rect))))]
{:top (- (+ (.-top rect) (.-scrollTop page-cnt)) (.-top cnt-offset))
:left (- (+ (.-left rect) (.-scrollLeft page-cnt)) (.-left cnt-offset))
:width (.-width rect)