0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 00:40:30 -05:00

🐛 Fix proportion locking.

This commit is contained in:
Andrey Antukh 2020-09-14 16:52:22 +02:00 committed by Alonso Torres
parent a33689cbae
commit 50321895e5

View file

@ -152,8 +152,6 @@
(file-initialized project-id file-id))))
))))
(defn- file-initialized
[project-id file-id]
(ptk/reify ::file-initialized
@ -995,8 +993,6 @@
;; Event mainly used for handling user modification of the size of the
;; object from workspace sidebar options inputs.
;; TODO: maybe replace directly with dwc/update-shapes?
(defn update-dimensions
[ids attr value]
(us/verify (s/coll-of ::us/uuid) ids)
@ -1012,17 +1008,14 @@
(defn set-shape-proportion-lock
[id lock]
(js/alert "TODO: broken")
#_(ptk/reify ::set-shape-proportion-lock
ptk/UpdateEvent
(update [_ state]
(let [page-id (:current-page-id state)
shape (get-in state [:workspace-data page-id :objects id])]
(if-not lock
(assoc-in state [:workspace-data page-id :objects id :proportion-lock] lock))
(->> (geom/assign-proportions (assoc shape :proportion-lock lock))
(assoc-in state [:workspace-data page-id :objects id]))))))
(ptk/reify ::set-shape-proportion-lock
ptk/WatchEvent
(watch [_ state stream]
(rx/of (dwc/update-shapes [id] (fn [shape]
(if-not lock
(assoc shape :proportion-lock false)
(-> (assoc shape :proportion-lock true)
(geom/assign-proportions)))))))))
;; --- Update Shape Position
(s/def ::x number?)