mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -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
|
(mf/use-callback
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [target (dom/get-target event)
|
(let [target (dom/get-target event)
|
||||||
closest (.closest target ".public-DraftStyleDefault-block")]
|
closest (.closest target "foreignObject")]
|
||||||
(when-not closest
|
;; Capture mouse pointer to detect the movements even if cursor
|
||||||
;; Capture mouse pointer to detect the movements even if cursor
|
;; leaves the viewport or the browser itself
|
||||||
;; leaves the viewport or the browser itself
|
;; https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
|
||||||
;; https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture
|
(if closest
|
||||||
|
(.setPointerCapture closest (.-pointerId event))
|
||||||
(.setPointerCapture target (.-pointerId event))))))
|
(.setPointerCapture target (.-pointerId event))))))
|
||||||
|
|
||||||
on-pointer-up
|
on-pointer-up
|
||||||
|
|
Loading…
Add table
Reference in a new issue