Skip to content

Commit

Permalink
SvgImport: Fix issues introduced in 6f4890c
Browse files Browse the repository at this point in the history
  • Loading branch information
lehni committed Feb 15, 2016
1 parent 3d330da commit 16a7baa
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/svg/SvgImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ new function() {
return item;
}

function importSVG(source, options) {
function importSVG(source, options, owner) {
if (!source)
return null;
options = typeof options === 'function' ? { onLoad: options }
Expand All @@ -650,6 +650,10 @@ new function() {
}
paper = scope;
item = importNode(node, options, true);
if (!options || options.insert !== false) {
// TODO: Implement support for multiple Layers on Project.
owner._insertItem(undefined, item);
}
var onLoad = options.onLoad;
if (onLoad)
onLoad(item, svg);
Expand Down Expand Up @@ -705,23 +709,15 @@ new function() {
// NOTE: Documentation is in Item#importSVG()
Item.inject({
importSVG: function(node, options) {
var res = importSVG(node, options);
if (!options || options.insert !== false)
this.addChild(res);
return res;
return importSVG(node, options, this);
}
});

// NOTE: Documentation is in Project#importSVG()
Project.inject({
importSVG: function(node, options) {
this.activate();
var res = importSVG(node, options);
if (!options || options.insert !== false) {
// TODO: Implement support for Layer parsing / insertion.
this.getActiveLayer().addChild(res);
}
return res;
return importSVG(node, options, this);
}
});
};

0 comments on commit 16a7baa

Please sign in to comment.