mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 16:21:57 -05:00
⚡ Add minor optimizations to shapes/circle component
This commit is contained in:
parent
9993d357da
commit
c8b42478b0
1 changed files with 15 additions and 13 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.ui.shapes.circle
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.ui.shapes.attrs :as attrs]
|
||||
[app.main.ui.shapes.custom-stroke :refer [shape-custom-strokes]]
|
||||
|
@ -16,21 +17,22 @@
|
|||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [shape (unchecked-get props "shape")
|
||||
{:keys [x y width height]} shape
|
||||
transform (gsh/transform-str shape)
|
||||
|
||||
cx (+ x (/ width 2))
|
||||
cy (+ y (/ height 2))
|
||||
rx (/ width 2)
|
||||
ry (/ height 2)
|
||||
x (dm/get-prop shape :x)
|
||||
y (dm/get-prop shape :y)
|
||||
w (dm/get-prop shape :width)
|
||||
h (dm/get-prop shape :height)
|
||||
|
||||
props (-> (attrs/extract-style-attrs shape)
|
||||
(obj/merge!
|
||||
#js {:cx cx
|
||||
:cy cy
|
||||
:rx rx
|
||||
:ry ry
|
||||
:transform transform}))]
|
||||
t (gsh/transform-str shape)
|
||||
|
||||
cx (+ x (/ w 2))
|
||||
cy (+ y (/ h 2))
|
||||
rx (/ w 2)
|
||||
ry (/ h 2)
|
||||
|
||||
props (mf/with-memo [shape]
|
||||
(-> (attrs/extract-style-attrs shape)
|
||||
(obj/merge! #js {:cx cx :cy cy :rx rx :ry ry :transform t})))]
|
||||
|
||||
[:& shape-custom-strokes {:shape shape}
|
||||
[:> :ellipse props]]))
|
||||
|
|
Loading…
Add table
Reference in a new issue