Skip to content

Commit

Permalink
improve(pdf): support ⌘/alt with area highlight selection
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 committed Aug 6, 2021
1 parent cdc000e commit 6a39c27
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/frontend/extensions/pdf/highlights.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,14 @@
[_ set-area-mode!] (use-atom *area-mode?)

should-start (fn [^js e]
(when (.closest (.-target e) ".page")
(and e (or (.-altKey e) @*area-mode?))))
(dd (.-target e))
(let [^js target (.-target e)]
(when (and (not
(.contains (.-classList target) "extensions__pdf-hls-area-region"))
(.closest target ".page"))
(and e (or (.-metaKey e)
(.-altKey e)
@*area-mode?)))))

reset-coords #(do
(set-start-coord! nil)
Expand Down Expand Up @@ -789,8 +795,8 @@

;; selection
[:a.button
{:title "Area highlight (Alt)"
:class (if area-mode? "is-active")
{:title (str "Area highlight (" (if front-utils/mac? "" "alt") ")")
:class (if area-mode? "is-active")
:on-click #(set-area-mode! (not area-mode?))}
(svg/area 18)]

Expand Down

0 comments on commit 6a39c27

Please sign in to comment.