0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

Merge pull request #3285 from penpot/hiru-fill-problems

🐛 Revert #9de962bb and solve the fill issues in a different way
This commit is contained in:
Pablo Alba 2023-06-16 11:56:39 +02:00 committed by GitHub
commit 5cab599a06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 12 deletions

View file

@ -194,8 +194,13 @@
(obj/set! "fill" (obj/get svg-attrs "fill"))
(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 black
;; If the shape comes from an imported SVG (we know because it has
;; the :svg-attrs atribute), and it does not have an own fill, we
;; set a default black fill. This will be inherited by child nodes,
;; and is for emulating the behavior of standard SVG, in that a node
;; that has no explicit fill has a default fill of black.
;; This may be reset to normal if a Penpot frame shape appears below
;; (see main.ui.shapes.frame/frame-container).
(and (contains? shape :svg-attrs)
(#{:svg-raw :group} (:type shape))
(empty? (:fills shape)))

View file

@ -370,9 +370,7 @@
(-> props
(obj/set! "style" style)))
(and (some? svg-attrs)
(obj/contains? svg-attrs "fill")
(empty? (:fills shape)))
(and (some? svg-attrs) (empty? (:fills shape)))
(let [style
(-> (obj/get child "props")
(obj/get "style")
@ -407,7 +405,7 @@
(obj/set! "style" style)))
:else
nil)))
(obj/create))))
(defn build-stroke-props [position child value render-id]
(let [props (-> (obj/get child "props")
@ -430,11 +428,10 @@
position (or (obj/get props "position") 0)
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))
fill-props (build-fill-props shape child position render-id)]
(when (some? fill-props)
[:g.fills {:id (dm/fmt "fills-%" (:id shape))}
[:> elem-name (-> (obj/get child "props")
(obj/clone)
(obj/merge! fill-props))]])))
[:g.fills {:id (dm/fmt "fills-%" (:id shape))}
[:> elem-name (-> (obj/get child "props")
(obj/clone)
(obj/merge! fill-props))]]))
(mf/defc shape-strokes
{::mf/wrap-props false}

View file

@ -69,7 +69,10 @@
:className "frame-background"}))
path? (some? (.-d props))]
[:*
[:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))}
[:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))
:fill "none"} ;; A frame sets back normal fill behavior (default transparent). It may have
;; been changed to default black if a shape coming from an imported SVG file
;; is rendered. See main.ui.shapes.attrs/add-style-attrs.
[:& frame-clip-def {:shape shape :render-id render-id}]
[:& shape-fills {:shape shape}