mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
🐛 Handle properly the mouse capture.
This commit is contained in:
parent
fde6126ac6
commit
48747d9553
1 changed files with 6 additions and 5 deletions
|
@ -435,11 +435,12 @@
|
|||
(mf/use-callback
|
||||
(fn [event]
|
||||
(let [target (dom/get-target event)
|
||||
closest (.closest target ".public-DraftStyleDefault-block")]
|
||||
(when-not closest
|
||||
;; Capture mouse pointer to detect the movements even if cursor
|
||||
;; leaves the viewport or the browser itself
|
||||
;; https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
|
||||
closest (.closest target "foreignObject")]
|
||||
;; Capture mouse pointer to detect the movements even if cursor
|
||||
;; leaves the viewport or the browser itself
|
||||
;; https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
|
||||
(if closest
|
||||
(.setPointerCapture closest (.-pointerId event))
|
||||
(.setPointerCapture target (.-pointerId event))))))
|
||||
|
||||
on-pointer-up
|
||||
|
|
Loading…
Reference in a new issue