mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -05:00
parent
917139bb3f
commit
575436bafe
1 changed files with 6 additions and 5 deletions
|
@ -87,19 +87,20 @@ new function() {
|
||||||
// items and avoid calling applyAttributes() again.
|
// items and avoid calling applyAttributes() again.
|
||||||
project._currentStyle = item._style.clone();
|
project._currentStyle = item._style.clone();
|
||||||
}
|
}
|
||||||
// Put defs first, Affinity designer exports defs as last
|
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
var defsNodes = [], otherNodes = [];
|
// Import all defs first, since in SVG they can be in any location.
|
||||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
// e.g. Affinity Designer exports defs as last.
|
||||||
nodes[i].nodeName.toLowerCase() === 'defs' ? defsNodes.push(nodes[i]) : otherNodes.push(nodes[i]);
|
var defs = node.querySelectorAll('defs');
|
||||||
|
for (var i = 0, l = defs.length; i < l; i++) {
|
||||||
|
importSVG(defs[i], options, false);
|
||||||
}
|
}
|
||||||
nodes = defsNodes.concat(otherNodes);
|
|
||||||
}
|
}
|
||||||
// Collect the children in an array and apply them all at once.
|
// Collect the children in an array and apply them all at once.
|
||||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||||
var childNode = nodes[i],
|
var childNode = nodes[i],
|
||||||
child;
|
child;
|
||||||
if (childNode.nodeType === 1
|
if (childNode.nodeType === 1
|
||||||
|
&& childNode.nodeName.toLowerCase() !== 'defs'
|
||||||
&& (child = importSVG(childNode, options, false))
|
&& (child = importSVG(childNode, options, false))
|
||||||
&& !(child instanceof Symbol))
|
&& !(child instanceof Symbol))
|
||||||
children.push(child);
|
children.push(child);
|
||||||
|
|
Loading…
Reference in a new issue