mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -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:
commit
5cab599a06
3 changed files with 17 additions and 12 deletions
|
@ -194,8 +194,13 @@
|
||||||
(obj/set! "fill" (obj/get svg-attrs "fill"))
|
(obj/set! "fill" (obj/get svg-attrs "fill"))
|
||||||
(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 the shape comes from an imported SVG (we know because it has
|
||||||
;; we setup the default fill as black
|
;; 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)
|
(and (contains? shape :svg-attrs)
|
||||||
(#{:svg-raw :group} (:type shape))
|
(#{:svg-raw :group} (:type shape))
|
||||||
(empty? (:fills shape)))
|
(empty? (:fills shape)))
|
||||||
|
|
|
@ -370,9 +370,7 @@
|
||||||
(-> props
|
(-> props
|
||||||
(obj/set! "style" style)))
|
(obj/set! "style" style)))
|
||||||
|
|
||||||
(and (some? svg-attrs)
|
(and (some? svg-attrs) (empty? (:fills shape)))
|
||||||
(obj/contains? svg-attrs "fill")
|
|
||||||
(empty? (:fills shape)))
|
|
||||||
(let [style
|
(let [style
|
||||||
(-> (obj/get child "props")
|
(-> (obj/get child "props")
|
||||||
(obj/get "style")
|
(obj/get "style")
|
||||||
|
@ -407,7 +405,7 @@
|
||||||
(obj/set! "style" style)))
|
(obj/set! "style" style)))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
nil)))
|
(obj/create))))
|
||||||
|
|
||||||
(defn build-stroke-props [position child value render-id]
|
(defn build-stroke-props [position child value render-id]
|
||||||
(let [props (-> (obj/get child "props")
|
(let [props (-> (obj/get child "props")
|
||||||
|
@ -430,11 +428,10 @@
|
||||||
position (or (obj/get props "position") 0)
|
position (or (obj/get props "position") 0)
|
||||||
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))
|
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))
|
||||||
fill-props (build-fill-props shape child position render-id)]
|
fill-props (build-fill-props shape child position render-id)]
|
||||||
(when (some? fill-props)
|
[:g.fills {:id (dm/fmt "fills-%" (:id shape))}
|
||||||
[:g.fills {:id (dm/fmt "fills-%" (:id shape))}
|
[:> elem-name (-> (obj/get child "props")
|
||||||
[:> elem-name (-> (obj/get child "props")
|
(obj/clone)
|
||||||
(obj/clone)
|
(obj/merge! fill-props))]]))
|
||||||
(obj/merge! fill-props))]])))
|
|
||||||
|
|
||||||
(mf/defc shape-strokes
|
(mf/defc shape-strokes
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
|
|
|
@ -69,7 +69,10 @@
|
||||||
:className "frame-background"}))
|
:className "frame-background"}))
|
||||||
path? (some? (.-d props))]
|
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}]
|
[:& frame-clip-def {:shape shape :render-id render-id}]
|
||||||
|
|
||||||
[:& shape-fills {:shape shape}
|
[:& shape-fills {:shape shape}
|
||||||
|
|
Loading…
Add table
Reference in a new issue