🐛 Fix problem with imported svgs with filters

This commit is contained in:
alonso.torres 2022-01-13 15:15:55 +01:00
parent 9ac4239c11
commit 6090cf6c68
3 changed files with 21 additions and 17 deletions

View file

@ -52,6 +52,7 @@
- Fix blur input field when click on viewport [Taiga #2164](https://tree.taiga.io/project/penpot/issue/2164) - Fix blur input field when click on viewport [Taiga #2164](https://tree.taiga.io/project/penpot/issue/2164)
- Fix default page id in workspace [Taiga #2205](https://tree.taiga.io/project/penpot/issue/2205) - Fix default page id in workspace [Taiga #2205](https://tree.taiga.io/project/penpot/issue/2205)
- Fix problem when importing a file with grids [Taiga #2314](https://tree.taiga.io/project/penpot/issue/2314) - Fix problem when importing a file with grids [Taiga #2314](https://tree.taiga.io/project/penpot/issue/2314)
- Fix problem with imported svgs with filters [Taiga #2478](https://tree.taiga.io/project/penpot/issue/2478)
- Fix issues when updating selrect in paths [Taiga #2366](https://tree.taiga.io/project/penpot/issue/2366) - Fix issues when updating selrect in paths [Taiga #2366](https://tree.taiga.io/project/penpot/issue/2366)
- Fix scroll jumps in handoff mode [Taiga #2383](https://tree.taiga.io/project/penpot/issue/2383) - Fix scroll jumps in handoff mode [Taiga #2383](https://tree.taiga.io/project/penpot/issue/2383)
- Fix handoff text with opacity [Taiga #2384](https://tree.taiga.io/project/penpot/issue/2384) - Fix handoff text with opacity [Taiga #2384](https://tree.taiga.io/project/penpot/issue/2384)

View file

@ -179,25 +179,28 @@
[attrs styles])) [attrs styles]))
(defn add-style-attrs (defn add-style-attrs
[props shape] ([props shape]
(let [render-id (mf/use-ctx muc/render-ctx) (let [render-id (mf/use-ctx muc/render-ctx)]
svg-defs (:svg-defs shape {}) (add-style-attrs props shape render-id)))
svg-attrs (:svg-attrs shape {})
[svg-attrs svg-styles] (mf/use-memo ([props shape render-id]
(mf/deps render-id svg-defs svg-attrs) (let [svg-defs (:svg-defs shape {})
#(extract-svg-attrs render-id svg-defs svg-attrs)) svg-attrs (:svg-attrs shape {})
styles (-> (obj/get props "style" (obj/new)) [svg-attrs svg-styles] (mf/use-memo
(obj/merge! svg-styles) (mf/deps render-id svg-defs svg-attrs)
(add-fill shape render-id) #(extract-svg-attrs render-id svg-defs svg-attrs))
(add-stroke shape render-id)
(add-layer-props shape))]
(-> props styles (-> (obj/get props "style" (obj/new))
(obj/merge! svg-attrs) (obj/merge! svg-styles)
(add-border-radius shape) (add-fill shape render-id)
(obj/set! "style" styles)))) (add-stroke shape render-id)
(add-layer-props shape))]
(-> props
(obj/merge! svg-attrs)
(add-border-radius shape)
(obj/set! "style" styles)))))
(defn extract-style-attrs (defn extract-style-attrs
[shape] [shape]

View file

@ -53,7 +53,7 @@
(obj/set! "clipPath" (frame/frame-clip-url shape render-id)) (obj/set! "clipPath" (frame/frame-clip-url shape render-id))
(= :group type) (= :group type)
(attrs/add-style-attrs shape))] (attrs/add-style-attrs shape render-id))]
[:& (mf/provider muc/render-ctx) {:value render-id} [:& (mf/provider muc/render-ctx) {:value render-id}
[:> :g wrapper-props [:> :g wrapper-props