mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
💄 Add cosmetic changes on viewport hooks and actions
This commit is contained in:
parent
ea5b153578
commit
23d358aea7
2 changed files with 16 additions and 14 deletions
|
@ -337,7 +337,7 @@
|
|||
|
||||
(defn on-pointer-move [move-stream]
|
||||
(let [last-position (mf/use-var nil)]
|
||||
(mf/use-callback
|
||||
(mf/use-fn
|
||||
(fn [event]
|
||||
(let [raw-pt (dom/get-client-position event)
|
||||
pt (uwvv/point->viewport raw-pt)
|
||||
|
@ -347,6 +347,7 @@
|
|||
delta (if @last-position
|
||||
(gpt/subtract raw-pt @last-position)
|
||||
(gpt/point 0 0))]
|
||||
|
||||
(rx/push! move-stream pt)
|
||||
(reset! last-position raw-pt)
|
||||
(st/emit! (ms/->PointerEvent :delta delta
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
(fn [point]
|
||||
(let [zoom (mf/ref-val zoom-ref)
|
||||
rect (grc/center->rect point (/ 5 zoom) (/ 5 zoom))]
|
||||
|
||||
(if (mf/ref-val hover-disabled-ref)
|
||||
(rx/of nil)
|
||||
(->> (uw/ask-buffered!
|
||||
|
@ -152,20 +153,20 @@
|
|||
(rx/filter some?))))))
|
||||
|
||||
over-shapes-stream
|
||||
(mf/use-memo
|
||||
(fn []
|
||||
(rx/merge
|
||||
;; This stream works to "refresh" the outlines when the control is pressed
|
||||
;; but the mouse has not been moved from its position.
|
||||
(->> mod-str
|
||||
(rx/observe-on :async)
|
||||
(rx/map #(deref last-point-ref))
|
||||
(rx/merge-map query-point))
|
||||
(mf/with-memo [move-stream mod-str]
|
||||
(rx/merge
|
||||
;; This stream works to "refresh" the outlines when the control is pressed
|
||||
;; but the mouse has not been moved from its position.
|
||||
(->> mod-str
|
||||
(rx/observe-on :async)
|
||||
(rx/map #(deref last-point-ref))
|
||||
(rx/filter some?)
|
||||
(rx/merge-map query-point))
|
||||
|
||||
(->> move-stream
|
||||
(rx/tap #(reset! last-point-ref %))
|
||||
;; When transforming shapes we stop querying the worker
|
||||
(rx/merge-map query-point)))))]
|
||||
(->> move-stream
|
||||
(rx/tap #(reset! last-point-ref %))
|
||||
;; When transforming shapes we stop querying the worker
|
||||
(rx/merge-map query-point))))]
|
||||
|
||||
;; Refresh the refs on a value change
|
||||
(mf/use-effect
|
||||
|
|
Loading…
Add table
Reference in a new issue