mirror of
https://github.com/penpot/penpot.git
synced 2025-01-27 08:59:17 -05:00
Merge pull request #1886 from penpot/superalex-multiple-fills-with-texts-are-not-working-properly
🐛 Fix multiple fills with texts are not working properly
This commit is contained in:
commit
698dd872e4
2 changed files with 13 additions and 10 deletions
|
@ -318,7 +318,7 @@
|
||||||
[:& stroke-defs {:shape shape :render-id render-id :index index}]]
|
[:& stroke-defs {:shape shape :render-id render-id :index index}]]
|
||||||
child])))
|
child])))
|
||||||
|
|
||||||
(defn build-fill-props [shape child render-id]
|
(defn build-fill-props [shape child position render-id]
|
||||||
(let [url-fill? (or (some? (:fill-image shape))
|
(let [url-fill? (or (some? (:fill-image shape))
|
||||||
(= :image (:type shape))
|
(= :image (:type shape))
|
||||||
(> (count (:fills shape)) 1)
|
(> (count (:fills shape)) 1)
|
||||||
|
@ -349,7 +349,7 @@
|
||||||
(-> (obj/get props "style")
|
(-> (obj/get props "style")
|
||||||
(obj/clone)
|
(obj/clone)
|
||||||
(obj/without ["fill" "fillOpacity"])))]
|
(obj/without ["fill" "fillOpacity"])))]
|
||||||
(obj/set! props "fill" (dm/fmt "url(#fill-0-%)" render-id)))
|
(obj/set! props "fill" (dm/fmt "url(#fill-%-%)" position render-id)))
|
||||||
|
|
||||||
(and (some? svg-styles) (obj/contains? svg-styles "fill"))
|
(and (some? svg-styles) (obj/contains? svg-styles "fill"))
|
||||||
(let [style
|
(let [style
|
||||||
|
@ -415,9 +415,10 @@
|
||||||
(let [child (obj/get props "children")
|
(let [child (obj/get props "children")
|
||||||
shape (obj/get props "shape")
|
shape (obj/get props "shape")
|
||||||
elem-name (obj/get child "type")
|
elem-name (obj/get child "type")
|
||||||
render-id (mf/use-ctx muc/render-ctx)]
|
position (or (obj/get props "position") 0)
|
||||||
|
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx))]
|
||||||
[:g {:id (dm/fmt "fills-%" (:id shape))}
|
[:g {:id (dm/fmt "fills-%" (:id shape))}
|
||||||
[:> elem-name (build-fill-props shape child render-id)]]))
|
[:> elem-name (build-fill-props shape child position render-id)]]))
|
||||||
|
|
||||||
(mf/defc shape-strokes
|
(mf/defc shape-strokes
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
|
@ -425,7 +426,7 @@
|
||||||
(let [child (obj/get props "children")
|
(let [child (obj/get props "children")
|
||||||
shape (obj/get props "shape")
|
shape (obj/get props "shape")
|
||||||
elem-name (obj/get child "type")
|
elem-name (obj/get child "type")
|
||||||
render-id (mf/use-ctx muc/render-ctx)
|
render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx))
|
||||||
stroke-id (dm/fmt "strokes-%" (:id shape))
|
stroke-id (dm/fmt "strokes-%" (:id shape))
|
||||||
stroke-props (-> (obj/new)
|
stroke-props (-> (obj/new)
|
||||||
(obj/set! "id" stroke-id)
|
(obj/set! "id" stroke-id)
|
||||||
|
@ -450,8 +451,10 @@
|
||||||
(mf/defc shape-custom-strokes
|
(mf/defc shape-custom-strokes
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[props]
|
[props]
|
||||||
(let [children (obj/get props "children")
|
(let [children (obj/get props "children")
|
||||||
shape (obj/get props "shape")]
|
shape (obj/get props "shape")
|
||||||
|
position (obj/get props "position")
|
||||||
|
render-id (obj/get props "render-id")]
|
||||||
[:*
|
[:*
|
||||||
[:& shape-fills {:shape shape} children]
|
[:& shape-fills {:shape shape :position position :render-id render-id} children]
|
||||||
[:& shape-strokes {:shape shape} children]]))
|
[:& shape-strokes {:shape shape :position position :render-id render-id} children]]))
|
||||||
|
|
|
@ -111,6 +111,6 @@
|
||||||
shape (assoc shape :fills (:fills data))]
|
shape (assoc shape :fills (:fills data))]
|
||||||
|
|
||||||
[:& (mf/provider muc/render-ctx) {:value (str render-id "_" (:id shape) "_" index)}
|
[:& (mf/provider muc/render-ctx) {:value (str render-id "_" (:id shape) "_" index)}
|
||||||
[:& shape-custom-strokes {:shape shape :key index}
|
[:& shape-custom-strokes {:shape shape :position index :render-id render-id}
|
||||||
[:> :text props (:text data)]]]))]]))
|
[:> :text props (:text data)]]]))]]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue