mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 00:10:11 -05:00
🐛 Fix problems with imported SVG shadows
This commit is contained in:
parent
cd9bc1d8d7
commit
4b086ab2bc
5 changed files with 35 additions and 11 deletions
|
@ -1,5 +1,11 @@
|
||||||
# CHANGELOG
|
# 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
|
## 1.18.0
|
||||||
|
|
||||||
### :sparkles: New features
|
### :sparkles: New features
|
||||||
|
|
|
@ -67,6 +67,14 @@
|
||||||
shape-without-blur (dissoc shape :blur)
|
shape-without-blur (dissoc shape :blur)
|
||||||
shape-without-shadows (assoc shape :shadow [])
|
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
|
wrapper-props
|
||||||
(-> (obj/clone props)
|
(-> (obj/clone props)
|
||||||
(obj/without ["shape" "children" "disable-shadows?"])
|
(obj/without ["shape" "children" "disable-shadows?"])
|
||||||
|
@ -79,11 +87,8 @@
|
||||||
(= :group type)
|
(= :group type)
|
||||||
(attrs/add-style-attrs shape render-id)
|
(attrs/add-style-attrs shape render-id)
|
||||||
|
|
||||||
(and (or (cph/group-shape? shape)
|
(some? filter-str)
|
||||||
(cph/frame-shape? shape)
|
(obj/set! "filter" filter-str))
|
||||||
(cph/svg-raw-shape? shape))
|
|
||||||
(not disable-shadows?))
|
|
||||||
(obj/set! "filter" (filters/filter-str filter-id shape)))
|
|
||||||
|
|
||||||
svg-group? (and (contains? shape :svg-attrs) (= :group type))
|
svg-group? (and (contains? shape :svg-attrs) (= :group type))
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,16 @@
|
||||||
(or transform-filter?
|
(or transform-filter?
|
||||||
transform-mask?) (merge bounds)))
|
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)
|
[wrapper wrapper-props] (if (= tag :mask)
|
||||||
["g" #js {:className "svg-mask-wrapper"
|
["g" #js {:className "svg-mask-wrapper"
|
||||||
:transform (str transform)}]
|
:transform (str transform)}]
|
||||||
|
|
|
@ -181,11 +181,14 @@
|
||||||
|
|
||||||
(or (= (dom/get-tag-name node) "mask")
|
(or (= (dom/get-tag-name node) "mask")
|
||||||
(= (dom/get-tag-name node) "filter"))
|
(= (dom/get-tag-name node) "filter"))
|
||||||
(do
|
(let [old-x (dom/get-attribute node "data-old-x")
|
||||||
(dom/set-attribute! node "x" (dom/get-attribute node "data-old-x"))
|
old-y (dom/get-attribute node "data-old-y")
|
||||||
(dom/set-attribute! node "y" (dom/get-attribute node "data-old-y"))
|
old-width (dom/get-attribute node "data-old-width")
|
||||||
(dom/set-attribute! node "width" (dom/get-attribute node "data-old-width"))
|
old-height (dom/get-attribute node "data-old-height")]
|
||||||
(dom/set-attribute! node "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-x")
|
||||||
(dom/remove-attribute! node "data-old-y")
|
(dom/remove-attribute! node "data-old-y")
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1.18.0
|
1.18.1
|
||||||
|
|
Loading…
Reference in a new issue