0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Add setup-proportions function to geom helpers.

This commit is contained in:
Andrey Antukh 2016-09-28 22:06:18 +02:00
parent c9f8b5b562
commit 84ef0a75e1
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -251,6 +251,23 @@
[shape index point]
(assoc-in shape [:points index] point))
;; --- Setup Proportions
(declare setup-proportions-rect)
(defn setup-proportions
[shape]
(case (:type shape)
:rect (setup-proportions-rect shape)
:icon (setup-proportions-rect shape)
:circle (setup-proportions-rect shape)
shape))
(defn setup-proportions-rect
[shape]
(let [{:keys [width height]} (size shape)]
(assoc shape :proportion (/ width height))))
;; --- Resize (Absolute)
(declare resize-rect)