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