🐛 Fix incorrect props transformation on custom strokes component

This commit is contained in:
Andrey Antukh 2024-01-24 11:17:13 +01:00
parent 508af62dc0
commit 22502ff7c8

View file

@ -31,7 +31,7 @@
suffix (if (some? index) (dm/str "-" index) "") suffix (if (some? index) (dm/str "-" index) "")
clip-id (dm/str "inner-stroke-" render-id "-" shape-id suffix) clip-id (dm/str "inner-stroke-" render-id "-" shape-id suffix)
href (dm/str "#stroke-shape-" render-id "-" shape-id suffix)] href (dm/str "#stroke-shape-" render-id "-" shape-id suffix)]
[:> "clipPath" #js {:id clip-id} [:> "clipPath" {:id clip-id}
[:use {:href href}]])) [:use {:href href}]]))
(mf/defc outer-stroke-mask (mf/defc outer-stroke-mask
@ -473,7 +473,7 @@
shape-blur (get shape :blur) shape-blur (get shape :blur)
shape-fills (get shape :fills) shape-fills (get shape :fills)
shape-shadow (get shape :shadow) shape-shadow (get shape :shadow)
shape-strokes (get shape :strokes) shape-strokes (not-empty (get shape :strokes))
svg-attrs (attrs/get-svg-props shape render-id) svg-attrs (attrs/get-svg-props shape render-id)
@ -481,24 +481,22 @@
(obj/clone) (obj/clone)
(attrs/add-layer-styles! shape)) (attrs/add-layer-styles! shape))
props (-> svg-attrs props (mf/spread-props svg-attrs
(obj/merge! {:id stroke-id
{:id stroke-id :className "strokes"
:className "strokes" :style style})]
:style style}))
props (if ^boolean (cfh/frame-shape? shape)
props
(cond-> props
(and (some? shape-blur)
(not ^boolean (:hidden shape-blur)))
(obj/set! "filter" (dm/fmt "url(#filter-blur-%)" render-id))
(and (empty? shape-fills) (when-not ^boolean (cfh/frame-shape? shape)
(some? (->> shape-shadow (remove :hidden) seq))) (when (and (some? shape-blur)
(obj/set! "filter" (dm/fmt "url(#filter-%)" render-id))))] (not ^boolean (:hidden shape-blur)))
(obj/set! props "filter" (dm/fmt "url(#filter-blur-%)" render-id)))
(when (d/not-empty? shape-strokes) (when (and (empty? shape-fills)
(some? (->> shape-shadow (remove :hidden) not-empty)))
(obj/set! props "filter" (dm/fmt "url(#filter-%)" render-id))))
(when (some? shape-strokes)
[:> :g props [:> :g props
(for [[index value] (reverse (d/enumerate shape-strokes))] (for [[index value] (reverse (d/enumerate shape-strokes))]
[:& shape-custom-stroke {:shape shape [:& shape-custom-stroke {:shape shape