0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

Merge pull request #3620 from penpot/alotor-fix-over-shapes

🐛 Improved response time of over shapes
This commit is contained in:
Andrey Antukh 2023-09-12 11:59:51 +02:00 committed by GitHub
commit 34ddc00c8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,7 +168,11 @@
(rx/tap #(reset! last-point-ref %))
;; When transforming shapes we stop querying the worker
(rx/merge-map query-point)))
(rx/throttle 100)))]
(rx/share)))
over-shapes-stream-debounced
(->> over-shapes-stream (rx/debounce 50))]
;; Refresh the refs on a value change
(mf/use-effect
@ -197,6 +201,12 @@
(mf/deps focus)
#(mf/set-ref-val! focus-ref focus))
(hooks/use-stream
over-shapes-stream-debounced
(mf/deps objects)
(fn [_]
(reset! hover-top-frame-id (ctt/top-nested-frame objects (deref last-point-ref)))))
(hooks/use-stream
over-shapes-stream
(mf/deps page-id objects show-measures?)
@ -256,8 +266,7 @@
(get objects))]
(reset! hover hover-shape)
(reset! hover-ids ids)
(reset! hover-top-frame-id (ctt/top-nested-frame objects (deref last-point-ref))))))))
(reset! hover-ids ids))))))
(defn setup-viewport-modifiers
[modifiers objects]