mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Merge pull request #702 from jardakotesovec/Import-svg-defs-first
SVG Import defs first
This commit is contained in:
commit
917139bb3f
1 changed files with 8 additions and 0 deletions
|
@ -87,6 +87,14 @@ new function() {
|
|||
// items and avoid calling applyAttributes() again.
|
||||
project._currentStyle = item._style.clone();
|
||||
}
|
||||
// Put defs first, Affinity designer exports defs as last
|
||||
if (isRoot) {
|
||||
var defsNodes = [], otherNodes = [];
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
nodes[i].nodeName.toLowerCase() === 'defs' ? defsNodes.push(nodes[i]) : otherNodes.push(nodes[i]);
|
||||
}
|
||||
nodes = defsNodes.concat(otherNodes);
|
||||
}
|
||||
// Collect the children in an array and apply them all at once.
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
var childNode = nodes[i],
|
||||
|
|
Loading…
Reference in a new issue