Skip to content

Commit

Permalink
SVG Import defs first
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Jun 12, 2015
1 parent 6ec34fb commit b6e48ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/svg/SVGImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit b6e48ad

Please sign in to comment.