diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 2346da674..d39ba43f2 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -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) diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index 7a24ba008..cfb207beb 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -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