0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 15:51:37 -05:00

🐛 Fix import svg shapes without fill

This commit is contained in:
Alejandro Alonso 2022-05-11 11:03:56 +02:00
parent 238cd14eb8
commit efcabe7ffb
2 changed files with 23 additions and 2 deletions

View file

@ -192,7 +192,7 @@
(#{:svg-raw :group} (:type shape))
(empty? (:fills shape)))
(-> styles
(obj/set! "fill" clr/black))
(obj/set! "fill" (or (obj/get (:wrapper-styles shape) "fill") clr/black)))
(d/not-empty? (:fills shape))
(add-fill styles (d/without-nils (get-in shape [:fills 0])) render-id 0)

View file

@ -19,6 +19,21 @@
[app.util.object :as obj]
[rumext.alpha :as mf]))
(defn propagate-wrapper-styles
([children wrapper-props]
(let [children-props-childs (-> (obj/get children "props")
(obj/clone)
(-> (obj/get "childs")))
children-props-childs (map #(assoc % :wrapper-styles (obj/get wrapper-props "style")) children-props-childs)
children-props (-> (obj/get children "props")
(obj/clone)
(obj/set! "childs" children-props-childs))]
(-> (obj/clone children)
(obj/set! "props" children-props)))))
(mf/defc shape-container
{::mf/forward-ref true
::mf/wrap-props false}
@ -56,7 +71,13 @@
wrapper-props
(cond-> wrapper-props
(= :group type)
(attrs/add-style-attrs shape render-id))]
(attrs/add-style-attrs shape render-id))
svg-group? (and (contains? shape :svg-attrs) (= :group type))
children (cond-> children
svg-group?
(propagate-wrapper-styles wrapper-props))]
[:& (mf/provider muc/render-ctx) {:value render-id}
[:> :g wrapper-props