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:
parent
c9f8b5b562
commit
84ef0a75e1
1 changed files with 17 additions and 0 deletions
|
@ -251,6 +251,23 @@
|
||||||
[shape index point]
|
[shape index point]
|
||||||
(assoc-in shape [:points 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)
|
;; --- Resize (Absolute)
|
||||||
|
|
||||||
(declare resize-rect)
|
(declare resize-rect)
|
||||||
|
|
Loading…
Add table
Reference in a new issue