0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

🐛 Fix problems with imported SVG shadows

This commit is contained in:
alonso.torres 2023-04-03 12:28:57 +02:00
parent cd9bc1d8d7
commit 4b086ab2bc
5 changed files with 35 additions and 11 deletions

View file

@ -1,5 +1,11 @@
# CHANGELOG
## 1.18.1
### :bug: Bugs fixed
- Fix problems with imported SVG shadows [Taiga #4922](https://tree.taiga.io/project/penpot/issue/4922)
## 1.18.0
### :sparkles: New features

View file

@ -67,6 +67,14 @@
shape-without-blur (dissoc shape :blur)
shape-without-shadows (assoc shape :shadow [])
filter-str
(when (and (or (cph/group-shape? shape)
(cph/frame-shape? shape)
(cph/svg-raw-shape? shape))
(not disable-shadows?))
(filters/filter-str filter-id shape))
wrapper-props
(-> (obj/clone props)
(obj/without ["shape" "children" "disable-shadows?"])
@ -79,11 +87,8 @@
(= :group type)
(attrs/add-style-attrs shape render-id)
(and (or (cph/group-shape? shape)
(cph/frame-shape? shape)
(cph/svg-raw-shape? shape))
(not disable-shadows?))
(obj/set! "filter" (filters/filter-str filter-id shape)))
(some? filter-str)
(obj/set! "filter" filter-str))
svg-group? (and (contains? shape :svg-attrs) (= :group type))

View file

@ -64,6 +64,16 @@
(or transform-filter?
transform-mask?) (merge bounds)))
;; Fixes race condition with dynamic modifiers forcing redraw this properties before
;; the effect triggers
attrs
(cond-> attrs
(or (= tag :filter) (= tag :mask))
(merge {:data-old-x (:x attrs)
:data-old-y (:y attrs)
:data-old-width (:width attrs)
:data-old-height (:height attrs)}))
[wrapper wrapper-props] (if (= tag :mask)
["g" #js {:className "svg-mask-wrapper"
:transform (str transform)}]

View file

@ -181,11 +181,14 @@
(or (= (dom/get-tag-name node) "mask")
(= (dom/get-tag-name node) "filter"))
(do
(dom/set-attribute! node "x" (dom/get-attribute node "data-old-x"))
(dom/set-attribute! node "y" (dom/get-attribute node "data-old-y"))
(dom/set-attribute! node "width" (dom/get-attribute node "data-old-width"))
(dom/set-attribute! node "height" (dom/get-attribute node "data-old-height"))
(let [old-x (dom/get-attribute node "data-old-x")
old-y (dom/get-attribute node "data-old-y")
old-width (dom/get-attribute node "data-old-width")
old-height (dom/get-attribute node "data-old-height")]
(dom/set-attribute! node "x" old-x)
(dom/set-attribute! node "y" old-y)
(dom/set-attribute! node "width" old-width)
(dom/set-attribute! node "height" old-height)
(dom/remove-attribute! node "data-old-x")
(dom/remove-attribute! node "data-old-y")

View file

@ -1 +1 @@
1.18.0
1.18.1