mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 19:51:37 +02:00
✨ Integration with library new colors
This commit is contained in:
parent
7d7008d405
commit
245c39b1f6
11 changed files with 64 additions and 38 deletions
|
@ -25,7 +25,7 @@
|
|||
:ry (:ry shape)}))
|
||||
|
||||
(defn add-fill [attrs shape]
|
||||
(let [fill-color-gradient-id (str "fill-color-gradient_" (:id shape))]
|
||||
(let [fill-color-gradient-id (str "fill-color-gradient_" (:render-id shape))]
|
||||
(if (:fill-color-gradient shape)
|
||||
(obj/merge! attrs #js {:fill (str/format "url(#%s)" fill-color-gradient-id)})
|
||||
(obj/merge! attrs #js {:fill (or (:fill-color shape) "transparent")
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
(defn add-stroke [attrs shape]
|
||||
(let [stroke-style (:stroke-style shape :none)
|
||||
stroke-color-gradient-id (str "stroke-color-gradient_" (:id shape))]
|
||||
stroke-color-gradient-id (str "stroke-color-gradient_" (:render-id shape))]
|
||||
(if (not= stroke-style :none)
|
||||
(if (:stroke-color-gradient shape)
|
||||
(obj/merge! attrs
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
scale-factor-x (* scale-factor-y (:width gradient))
|
||||
|
||||
scale-vec (gpt/point (* scale-factor-y (/ height 2))
|
||||
(* scale-factor-x (/ width 2))
|
||||
)
|
||||
(* scale-factor-x (/ width 2)))
|
||||
|
||||
tr-translate (str/fmt "translate(%s, %s)" (:x translate-vec) (:y translate-vec))
|
||||
tr-rotate (str/fmt "rotate(%s)" angle)
|
||||
tr-scale (str/fmt "scale(%s, %s)" (:x scale-vec) (:y scale-vec))
|
||||
|
@ -72,8 +72,9 @@
|
|||
[props]
|
||||
(let [attr (obj/get props "attr")
|
||||
shape (obj/get props "shape")
|
||||
render-id (obj/get props "render-id")
|
||||
|
||||
id (str (name attr) "_" (:id shape))
|
||||
id (str (name attr) "_" render-id)
|
||||
gradient (get shape attr)
|
||||
gradient-props #js {:id id
|
||||
:gradient gradient
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue