mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 12:46:11 +02:00
🐛 Fix import svg shapes without fill
This commit is contained in:
parent
0bcf3d99a0
commit
8d399cb562
2 changed files with 12 additions and 16 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(ns app.main.ui.shapes.attrs
|
(ns app.main.ui.shapes.attrs
|
||||||
(: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]
|
||||||
|
@ -186,11 +187,12 @@
|
||||||
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity")))
|
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity")))
|
||||||
|
|
||||||
;; If contains svg-attrs the origin is svg. If it's not svg origin
|
;; 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)
|
(and (contains? shape :svg-attrs)
|
||||||
(#{:svg-raw :group} (:type shape))
|
(#{:svg-raw :group} (:type shape))
|
||||||
(empty? (:fills shape)))
|
(empty? (:fills shape)))
|
||||||
styles
|
(-> styles
|
||||||
|
(obj/set! "fill" clr/black))
|
||||||
|
|
||||||
(d/not-empty? (:fills shape))
|
(d/not-empty? (:fills shape))
|
||||||
(add-fill styles (d/without-nils (get-in shape [:fills 0])) render-id 0)
|
(add-fill styles (d/without-nils (get-in shape [:fills 0])) render-id 0)
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
(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]
|
||||||
|
@ -361,16 +360,19 @@
|
||||||
(-> props
|
(-> props
|
||||||
(obj/set! "style" style)))
|
(obj/set! "style" style)))
|
||||||
|
|
||||||
(and (some? svg-attrs) (obj/contains? svg-attrs "fill"))
|
(some? svg-attrs)
|
||||||
(let [style
|
(let [style
|
||||||
(-> (obj/get props "style")
|
(-> (obj/get props "style")
|
||||||
(obj/clone)
|
(obj/clone))
|
||||||
(obj/set! "fill" (obj/get svg-attrs "fill"))
|
|
||||||
(obj/set! "fillOpacity" (obj/get svg-attrs "fillOpacity")))]
|
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
|
(-> props
|
||||||
(obj/set! "style" style)))
|
(obj/set! "style" style)))
|
||||||
|
|
||||||
|
|
||||||
(d/not-empty? (:fills shape))
|
(d/not-empty? (:fills shape))
|
||||||
(let [fill-props
|
(let [fill-props
|
||||||
(attrs/extract-fill-attrs (get-in shape [:fills 0]) render-id 0)
|
(attrs/extract-fill-attrs (get-in shape [:fills 0]) render-id 0)
|
||||||
|
@ -383,14 +385,6 @@
|
||||||
(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")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue