mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Clear definitions lookup at the end of SVG import.
This commit is contained in:
parent
0f846098c4
commit
49728665e6
2 changed files with 8 additions and 5 deletions
|
@ -15,7 +15,6 @@
|
|||
* Paper.js DOM to a Paper.js DOM.
|
||||
*/
|
||||
new function() {
|
||||
|
||||
// Shortcut to Base.formatFloat
|
||||
var formatFloat = Base.formatFloat;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue