mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 00:47:18 +02:00
✨ Add more incremental improvements to shapes rendering.
That helps for make a good foundation for proper canvas painting and manipulation.
This commit is contained in:
parent
1fa9faa314
commit
6483800e49
14 changed files with 144 additions and 339 deletions
|
@ -12,7 +12,8 @@
|
|||
[uxbox.main.refs :as refs]
|
||||
[uxbox.main.store :as st]
|
||||
[uxbox.main.ui.keyboard :as kbd]
|
||||
[uxbox.main.ui.workspace.streams :as ws]
|
||||
[uxbox.main.ui.workspace.streams :as uws]
|
||||
[uxbox.util.geom.matrix :as gmt]
|
||||
[uxbox.util.dom :as dom]))
|
||||
|
||||
;; --- Shape Movement (by mouse)
|
||||
|
@ -24,17 +25,15 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [pid (get-in state [:workspace :current])
|
||||
wst (get-in state [:workspace pid])
|
||||
stoper (->> stream
|
||||
(rx/filter ws/mouse-up?)
|
||||
(rx/take 1))
|
||||
stream (->> ws/mouse-position-deltas
|
||||
(rx/take-until stoper))]
|
||||
(rx/concat
|
||||
(when (refs/alignment-activated? (:flags wst))
|
||||
(rx/of (dw/initial-shape-align id)))
|
||||
(rx/map #(dw/apply-temporal-displacement id %) stream)
|
||||
(rx/of (dw/apply-displacement id)))))))
|
||||
flags (get-in state [:workspace pid :flags])
|
||||
stoper (rx/filter uws/mouse-up? stream)]
|
||||
(rx/concat
|
||||
(when (refs/alignment-activated? flags)
|
||||
(rx/of (dw/initial-shape-align id)))
|
||||
(->> uws/mouse-position-deltas
|
||||
(rx/map #(dw/apply-temporal-displacement id %))
|
||||
(rx/take-until stoper))
|
||||
(rx/of (dw/materialize-current-modifier id)))))))
|
||||
|
||||
(defn start-move-selected
|
||||
[]
|
||||
|
@ -45,7 +44,6 @@
|
|||
selected (get-in state [:workspace pid :selected])]
|
||||
(rx/from-coll (map start-move selected))))))
|
||||
|
||||
|
||||
(defn on-mouse-down
|
||||
[event {:keys [id] :as shape} selected]
|
||||
(let [selected? (contains? selected id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue