From 5fd36893334a497a7187602277fd5085ab722f2c Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 20 Oct 2021 14:26:28 +0200 Subject: [PATCH] :bug: Fix no color when boolean with an SVG --- CHANGES.md | 1 + common/src/app/common/path/shapes_to_path.cljc | 7 ++++++- frontend/src/app/main/data/workspace/booleans.cljs | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3ba30de6a..1da4bf6ae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -46,6 +46,7 @@ - Fix paste in place in arboards [Taiga #2188](https://tree.taiga.io/project/penpot/issue/2188) - Fix font size input stuck on selection change [Taiga #2184](https://tree.taiga.io/project/penpot/issue/2184) - Fix stroke cut on shapes export [Taiga #2171](https://tree.taiga.io/project/penpot/issue/2171) +- Fix no color when boolean with an SVG [Taiga #2193](https://tree.taiga.io/project/penpot/issue/2193) ### :arrow_up: Deps updates diff --git a/common/src/app/common/path/shapes_to_path.cljc b/common/src/app/common/path/shapes_to_path.cljc index 7a41c60e7..d2f905914 100644 --- a/common/src/app/common/path/shapes_to_path.cljc +++ b/common/src/app/common/path/shapes_to_path.cljc @@ -176,7 +176,12 @@ (let [children (->> (:shapes shape) (map #(get objects %)) (map #(convert-to-path % objects))) - head (first children) + bool-type (:bool-type shape) + head (if (= bool-type :difference) (first children) (last children)) + head (cond-> head + (and (contains? head :svg-attrs) (nil? (:fill-color head))) + (assoc :fill-color "#000000")) + head-data (select-keys head style-properties) content (pb/content-bool (:bool-type shape) (mapv :content children))] diff --git a/frontend/src/app/main/data/workspace/booleans.cljs b/frontend/src/app/main/data/workspace/booleans.cljs index 25a03e57e..5c3c1af7b 100644 --- a/frontend/src/app/main/data/workspace/booleans.cljs +++ b/frontend/src/app/main/data/workspace/booleans.cljs @@ -33,6 +33,10 @@ [bool-type name shapes objects] (let [shapes (mapv #(stp/convert-to-path % objects) shapes) head (if (= bool-type :difference) (first shapes) (last shapes)) + head (cond-> head + (and (contains? head :svg-attrs) (nil? (:fill-color head))) + (assoc :fill-color "#000000")) + head-data (select-keys head stp/style-properties)] [(-> {:id (uuid/next) :type :bool @@ -51,7 +55,10 @@ (let [shapes (->> (:shapes group) (map #(get objects %)) (mapv #(stp/convert-to-path % objects))) - head (first shapes) + head (if (= bool-type :difference) (first shapes) (last shapes)) + head (cond-> head + (and (contains? head :svg-attrs) (nil? (:fill-color head))) + (assoc :fill-color "#000000")) head-data (select-keys head stp/style-properties)] (-> group