mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -05:00
Add support for circle shape in size geom function.
With minor private function naming refactor.
This commit is contained in:
parent
20cfae2a17
commit
17cdaab2cc
1 changed files with 15 additions and 6 deletions
|
@ -130,24 +130,33 @@
|
||||||
|
|
||||||
;; --- Size
|
;; --- Size
|
||||||
|
|
||||||
(declare rect-size)
|
(declare size-rect)
|
||||||
|
(declare size-circle)
|
||||||
|
|
||||||
(defn size
|
(defn size
|
||||||
"Calculate the size of the shape."
|
"Calculate the size of the shape."
|
||||||
[shape]
|
[shape]
|
||||||
(case (:type shape)
|
(case (:type shape)
|
||||||
:text (rect-size shape)
|
:circle (size-circle shape)
|
||||||
:rect (rect-size shape)
|
:text (size-rect shape)
|
||||||
:icon (rect-size shape)
|
:rect (size-rect shape)
|
||||||
:path (rect-size shape)))
|
:icon (size-rect shape)
|
||||||
|
:path (size-rect shape)))
|
||||||
|
|
||||||
(defn- rect-size
|
(defn- size-rect
|
||||||
"A specialized function for calculate size
|
"A specialized function for calculate size
|
||||||
for rect-like shapes."
|
for rect-like shapes."
|
||||||
[{:keys [x1 y1 x2 y2] :as shape}]
|
[{:keys [x1 y1 x2 y2] :as shape}]
|
||||||
{:width (- x2 x1)
|
{:width (- x2 x1)
|
||||||
:height (- y2 y1)})
|
:height (- y2 y1)})
|
||||||
|
|
||||||
|
(defn- size-circle
|
||||||
|
"A specialized function for calculate size
|
||||||
|
for circle shape."
|
||||||
|
[{:keys [rx ry]}]
|
||||||
|
{:width (* rx 2)
|
||||||
|
:height (* ry 2)})
|
||||||
|
|
||||||
;; --- Vertex Access
|
;; --- Vertex Access
|
||||||
|
|
||||||
(declare get-rect-vertext-point)
|
(declare get-rect-vertext-point)
|
||||||
|
|
Loading…
Reference in a new issue