mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
💄 Cosmetic changes on initial align shape event.
This commit is contained in:
parent
4df8a6b3b7
commit
eebd56d738
1 changed files with 10 additions and 11 deletions
|
@ -582,20 +582,19 @@
|
|||
|
||||
;; --- Shape Transformations
|
||||
|
||||
(defrecord InitialShapeAlign [id]
|
||||
ptk/WatchEvent
|
||||
(watch [_ state s]
|
||||
(let [{:keys [x1 y1] :as shape} (->> (get-in state [:shapes id])
|
||||
(geom/shape->rect-shape state))
|
||||
point (gpt/point x1 y1)]
|
||||
(->> (uwrk/align-point point)
|
||||
(rx/map (fn [{:keys [x y] :as pt}]
|
||||
(apply-temporal-displacement id (gpt/subtract pt point))))))))
|
||||
|
||||
(defn initial-shape-align
|
||||
[id]
|
||||
{:pre [(uuid? id)]}
|
||||
(InitialShapeAlign. id))
|
||||
(reify
|
||||
ptk/WatchEvent
|
||||
(watch [_ state s]
|
||||
(let [{:keys [x1 y1] :as shape} (->> (get-in state [:shapes id])
|
||||
(geom/shape->rect-shape state))
|
||||
point (gpt/point x1 y1)]
|
||||
(->> (uwrk/align-point point)
|
||||
(rx/map (fn [{:keys [x y] :as pt}]
|
||||
(apply-temporal-displacement id (gpt/subtract pt point)))))))))
|
||||
|
||||
|
||||
;; --- Apply Temporal Displacement
|
||||
|
||||
|
|
Loading…
Reference in a new issue