From 10b147a25d5c4ed45cbc727eecfa41e9ca480d3d Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 22 Feb 2022 10:48:20 +0100 Subject: [PATCH] :bug: Importing shapes without fills --- frontend/src/app/main/ui/shapes/attrs.cljs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index d85ebc5f5..1da44c40f 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -6,6 +6,7 @@ (ns app.main.ui.shapes.attrs (:require + [app.common.data :as d] [app.common.spec.radius :as ctr] [app.common.spec.shape :refer [stroke-caps-line stroke-caps-marker]] [app.main.ui.context :as muc] @@ -201,16 +202,16 @@ (= :image (:type shape)) (> (count (:fills shape)) 1) (some #(some? (:fill-color-gradient %)) (:fills shape))) - (obj/set! styles "fill" (str "url(#fill-" render-id ")")) + (obj/set! styles "fill" (str "url(#fill-" render-id ")")) - ;; imported svgs can have fill and fill-opacity attributes - (obj/contains? svg-styles "fill") - (-> styles - (obj/set! "fill" (obj/get svg-styles "fill")) - (obj/set! "fillOpacity" (obj/get svg-styles "fillOpacity"))) + ;; imported svgs can have fill and fill-opacity attributes + (obj/contains? svg-styles "fill") + (-> styles + (obj/set! "fill" (obj/get svg-styles "fill")) + (obj/set! "fillOpacity" (obj/get svg-styles "fillOpacity"))) - :else - (add-fill styles (get-in shape [:fills 0]) render-id 0))] + :else + (add-fill styles (d/without-nils (get-in shape [:fills 0])) render-id 0))] (-> props (obj/merge! svg-attrs)