0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-15 16:31:25 -05:00

🐛 Fix import svg shapes without fill

This commit is contained in:
Alejandro Alonso 2022-05-10 08:15:45 +02:00 committed by Alonso Torres
parent 0bcf3d99a0
commit 8d399cb562
2 changed files with 12 additions and 16 deletions
frontend/src/app/main/ui/shapes

View file

@ -6,6 +6,7 @@
(ns app.main.ui.shapes.attrs
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.geom.shapes :as gsh]
@ -186,11 +187,12 @@
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity")))
;; If contains svg-attrs the origin is svg. If it's not svg origin
;; we setup the default fill as transparent (instead of black)
;; we setup the default fill as black
(and (contains? shape :svg-attrs)
(#{:svg-raw :group} (:type shape))
(empty? (:fills shape)))
styles
(-> styles
(obj/set! "fill" clr/black))
(d/not-empty? (:fills shape))
(add-fill styles (d/without-nils (get-in shape [:fills 0])) render-id 0)

View file

@ -6,7 +6,6 @@
(ns app.main.ui.shapes.custom-stroke
(:require
[app.common.colors :as clr]
[app.common.data :as d]
[app.common.data.macros :as dm]
[app.common.geom.shapes :as gsh]
@ -361,16 +360,19 @@
(-> props
(obj/set! "style" style)))
(and (some? svg-attrs) (obj/contains? svg-attrs "fill"))
(some? svg-attrs)
(let [style
(-> (obj/get props "style")
(obj/clone)
(obj/set! "fill" (obj/get svg-attrs "fill"))
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity")))]
(obj/clone))
style (cond-> style
(obj/contains? svg-attrs "fill")
(->
(obj/set! "fill" (obj/get svg-attrs "fill"))
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity"))))]
(-> props
(obj/set! "style" style)))
(d/not-empty? (:fills shape))
(let [fill-props
(attrs/extract-fill-attrs (get-in shape [:fills 0]) render-id 0)
@ -383,14 +385,6 @@
(some? 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)))
(let [style
(-> (obj/get props "style")