mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 18:45:57 +02:00
🐛 Fixes problem with svg root fill color
This commit is contained in:
parent
fac6dd81b9
commit
ba12a2bc6d
1 changed files with 11 additions and 13 deletions
|
@ -47,6 +47,14 @@
|
||||||
val))))]
|
val))))]
|
||||||
(cd/mapm replace-ids attrs)))
|
(cd/mapm replace-ids attrs)))
|
||||||
|
|
||||||
|
(defn set-styles [attrs shape]
|
||||||
|
(let [custom-attrs (usa/extract-style-attrs shape)
|
||||||
|
style (obj/merge! (clj->js (:style attrs {}))
|
||||||
|
(obj/get custom-attrs "style"))]
|
||||||
|
(-> (clj->js attrs)
|
||||||
|
(obj/merge! custom-attrs)
|
||||||
|
(obj/set! "style" style))))
|
||||||
|
|
||||||
(mf/defc svg-root
|
(mf/defc svg-root
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
|
@ -59,7 +67,7 @@
|
||||||
|
|
||||||
ids-mapping (mf/use-memo #(generate-id-mapping content))
|
ids-mapping (mf/use-memo #(generate-id-mapping content))
|
||||||
|
|
||||||
attrs (-> (clj->js attrs)
|
attrs (-> (set-styles attrs shape)
|
||||||
(obj/set! "x" x)
|
(obj/set! "x" x)
|
||||||
(obj/set! "y" y)
|
(obj/set! "y" y)
|
||||||
(obj/set! "width" width)
|
(obj/set! "width" width)
|
||||||
|
@ -81,20 +89,10 @@
|
||||||
|
|
||||||
ids-mapping (mf/use-ctx svg-ids-ctx)
|
ids-mapping (mf/use-ctx svg-ids-ctx)
|
||||||
attrs (mf/use-memo #(replace-attrs-ids ids-mapping attrs))
|
attrs (mf/use-memo #(replace-attrs-ids ids-mapping attrs))
|
||||||
custom-attrs (usa/extract-style-attrs shape)
|
|
||||||
|
|
||||||
element-id (get-in content [:attrs :id])
|
element-id (get-in content [:attrs :id])
|
||||||
|
|
||||||
style (obj/merge! (clj->js (:style attrs {}))
|
attrs (cond-> (set-styles attrs shape)
|
||||||
(obj/get custom-attrs "style"))
|
element-id (obj/set! "id" (get ids-mapping element-id)))]
|
||||||
|
|
||||||
attrs (-> (clj->js attrs)
|
|
||||||
(obj/merge! custom-attrs)
|
|
||||||
(obj/set! "style" style))
|
|
||||||
|
|
||||||
attrs (cond-> attrs
|
|
||||||
element-id (obj/set! "id" (get ids-mapping element-id)))
|
|
||||||
]
|
|
||||||
[:> (name tag) attrs children]))
|
[:> (name tag) attrs children]))
|
||||||
|
|
||||||
(defn svg-raw-shape [shape-wrapper]
|
(defn svg-raw-shape [shape-wrapper]
|
||||||
|
|
Loading…
Add table
Reference in a new issue