🐛 Fix import svg shapes without fill

This commit is contained in:
Alejandro Alonso 2022-04-27 11:34:57 +02:00 committed by Alonso Torres
parent 39b0de1ced
commit fe1ae7dbb4
2 changed files with 16 additions and 9 deletions

View file

@ -124,7 +124,7 @@
(get-in shape [:svg-attrs :style :stroke-opacity]) (get-in shape [:svg-attrs :style :stroke-opacity])
(-> (update-in [:svg-attrs :style] dissoc :stroke-opacity) (-> (update-in [:svg-attrs :style] dissoc :stroke-opacity)
(assoc-in [:fills 0 :stroke-opacity] (-> (get-in shape [:svg-attrs :style :stroke-opacity]) (assoc-in [:strokes 0 :stroke-opacity] (-> (get-in shape [:svg-attrs :style :stroke-opacity])
(d/parse-double)))) (d/parse-double))))
(get-in shape [:svg-attrs :stroke-width]) (get-in shape [:svg-attrs :stroke-width])
@ -395,14 +395,12 @@
:image (create-image-shape name frame-id svg-data element-data) :image (create-image-shape name frame-id svg-data element-data)
#_other (create-raw-svg name frame-id svg-data element-data)))] #_other (create-raw-svg name frame-id svg-data element-data)))]
(when (some? shape) (when (some? shape)
(let [shape (assoc shape :fills []) (let [shape (-> shape
shape (assoc shape :strokes []) (assoc :fills [])
(assoc :strokes [])
shape (when (some? shape)
(-> shape
(assoc :svg-defs (select-keys (:defs svg-data) references)) (assoc :svg-defs (select-keys (:defs svg-data) references))
(setup-fill) (setup-fill)
(setup-stroke))) (setup-stroke))
children (cond->> (:content element-data) children (cond->> (:content element-data)
(or (= tag :g) (= tag :svg)) (or (= tag :g) (= tag :svg))

View file

@ -6,6 +6,7 @@
(ns app.main.ui.shapes.custom-stroke (ns app.main.ui.shapes.custom-stroke
(:require (:require
[app.common.colors :as clr]
[app.common.data :as d] [app.common.data :as d]
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.geom.shapes :as gsh] [app.common.geom.shapes :as gsh]
@ -382,6 +383,14 @@
(some? style) (some? style)
(obj/set! "style" style))) (obj/set! "style" style)))
(some? (:svg-attrs shape))
(let [style
(-> (obj/get props "style")
(obj/clone)
(obj/set! "fill" clr/black))]
(-> props
(obj/set! "style" style)))
(and (= :path (:type shape)) (empty? (:fills shape))) (and (= :path (:type shape)) (empty? (:fills shape)))
(let [style (let [style
(-> (obj/get props "style") (-> (obj/get props "style")