Clear definitions lookup at the end of SVG import.

This commit is contained in:
Jürg Lehni 2013-02-09 13:59:04 -08:00
parent 0f846098c4
commit 49728665e6
2 changed files with 8 additions and 5 deletions

View file

@ -15,7 +15,6 @@
* Paper.js DOM to a Paper.js DOM.
*/
new function() {
// Shortcut to Base.formatFloat
var formatFloat = Base.formatFloat;

View file

@ -502,11 +502,15 @@ new function() {
}
}
function importSvg(svg) {
function importSvg(svg, clearDefs) {
var type = svg.nodeName.toLowerCase(),
importer = importers[type],
item = importer && importer(svg, type);
return item && applyAttributes(item, svg);
item = item && applyAttributes(item, svg);
// Clear definitions at the end of import?
if (clearDefs)
definitions = {};
return item;
}
@ -519,7 +523,7 @@ new function() {
* @return {Item} the converted Paper.js item
*/
importSvg: function(svg) {
return this.addChild(importSvg(svg));
return this.addChild(importSvg(svg, true));
}
});
@ -533,7 +537,7 @@ new function() {
*/
importSvg: function(svg) {
this.activate();
return importSvg(svg);
return importSvg(svg, true);
}
});
};