mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
🐛 Fix problem inheriting attributes from SVG root when importing
This commit is contained in:
parent
8eacf738c2
commit
65894bf582
2 changed files with 18 additions and 12 deletions
|
@ -26,6 +26,7 @@
|
||||||
- Fix zoom context menu in viewer [Taiga #2041](https://tree.taiga.io/project/penpot/issue/2041)
|
- Fix zoom context menu in viewer [Taiga #2041](https://tree.taiga.io/project/penpot/issue/2041)
|
||||||
- Fix stroke caps adjustments in relation with stroke size [Taiga #2123](https://tree.taiga.io/project/penpot/issue/2123)
|
- Fix stroke caps adjustments in relation with stroke size [Taiga #2123](https://tree.taiga.io/project/penpot/issue/2123)
|
||||||
- Fix problem duplicating paths [Taiga #2147](https://tree.taiga.io/project/penpot/issue/2147)
|
- Fix problem duplicating paths [Taiga #2147](https://tree.taiga.io/project/penpot/issue/2147)
|
||||||
|
- Fix problem inheriting attributes from SVG root when importing [Taiga #2124](https://tree.taiga.io/project/penpot/issue/2124)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
|
|
|
@ -178,7 +178,8 @@
|
||||||
:y (+ y offset-y)}
|
:y (+ y offset-y)}
|
||||||
(gsh/setup-selrect)
|
(gsh/setup-selrect)
|
||||||
(assoc :svg-attrs (-> (:attrs svg-data)
|
(assoc :svg-attrs (-> (:attrs svg-data)
|
||||||
(dissoc :viewBox :xmlns))))))
|
(dissoc :viewBox :xmlns)
|
||||||
|
(d/without-keys usvg/inheritable-props))))))
|
||||||
|
|
||||||
(defn create-group [name frame-id svg-data {:keys [attrs]}]
|
(defn create-group [name frame-id svg-data {:keys [attrs]}]
|
||||||
(let [svg-transform (usvg/parse-transform (:transform attrs))
|
(let [svg-transform (usvg/parse-transform (:transform attrs))
|
||||||
|
@ -387,7 +388,7 @@
|
||||||
(setup-stroke)))
|
(setup-stroke)))
|
||||||
|
|
||||||
children (cond->> (:content element-data)
|
children (cond->> (:content element-data)
|
||||||
(= tag :g)
|
(or (= tag :g) (= tag :svg))
|
||||||
(mapv #(usvg/inherit-attributes attrs %)))]
|
(mapv #(usvg/inherit-attributes attrs %)))]
|
||||||
[shape children]))))
|
[shape children]))))
|
||||||
|
|
||||||
|
@ -487,11 +488,15 @@
|
||||||
;; Creates the root shape
|
;; Creates the root shape
|
||||||
changes (dwc/add-shape-changes page-id objects selected root-shape false)
|
changes (dwc/add-shape-changes page-id objects selected root-shape false)
|
||||||
|
|
||||||
|
root-attrs (-> (:attrs svg-data)
|
||||||
|
(usvg/format-styles))
|
||||||
|
|
||||||
;; Reduces the children to create the changes to add the children shapes
|
;; Reduces the children to create the changes to add the children shapes
|
||||||
[_ [rchanges uchanges]]
|
[_ [rchanges uchanges]]
|
||||||
(reduce (partial add-svg-child-changes page-id objects selected frame-id root-id svg-data)
|
(reduce (partial add-svg-child-changes page-id objects selected frame-id root-id svg-data)
|
||||||
[unames changes]
|
[unames changes]
|
||||||
(d/enumerate (:content svg-data)))
|
(d/enumerate (->> (:content svg-data)
|
||||||
|
(mapv #(usvg/inherit-attributes root-attrs %)))))
|
||||||
|
|
||||||
reg-objects-action {:type :reg-objects
|
reg-objects-action {:type :reg-objects
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
|
|
Loading…
Add table
Reference in a new issue