mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 07:21:38 +02:00
♻️ Refactor custom stroke
This commit is contained in:
parent
bf5f845789
commit
6cbbfa6499
7 changed files with 166 additions and 137 deletions
|
@ -6,23 +6,19 @@
|
|||
|
||||
(ns app.main.ui.shapes.rect
|
||||
(:require
|
||||
[rumext.alpha :as mf]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.ui.shapes.attrs :as attrs]
|
||||
[app.main.ui.shapes.custom-stroke :refer [shape-custom-stroke]]
|
||||
[app.common.geom.shapes :as geom]
|
||||
[app.util.object :as obj]
|
||||
[app.main.ui.shapes.gradients :refer [gradient]]
|
||||
|
||||
[cuerdas.core :as str]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.geom.point :as gpt]))
|
||||
[app.util.object :as obj]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc rect-shape
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [shape (unchecked-get props "shape")
|
||||
{:keys [id x y width height]} shape
|
||||
transform (geom/transform-matrix shape)
|
||||
transform (gsh/transform-matrix shape)
|
||||
|
||||
props (-> (attrs/extract-style-attrs shape)
|
||||
(obj/merge!
|
||||
|
@ -30,11 +26,11 @@
|
|||
:y y
|
||||
:transform transform
|
||||
:width width
|
||||
:height height}))]
|
||||
:height height}))
|
||||
|
||||
[:& shape-custom-stroke {:shape shape
|
||||
:base-props props
|
||||
:elem-name
|
||||
(if (.-d props)
|
||||
"path"
|
||||
"rect")}]))
|
||||
path? (some? (.-d props))]
|
||||
|
||||
[:& shape-custom-stroke {:shape shape}
|
||||
(if path?
|
||||
[:> :path props]
|
||||
[:> :rect props])]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue