mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Allow the SVGExport code to assume that the option object is always defined.
This commit is contained in:
parent
dc3bd30ee3
commit
77b142bec4
1 changed files with 7 additions and 6 deletions
|
@ -365,7 +365,7 @@ new function() {
|
||||||
}
|
}
|
||||||
// Clear definitions at the end of export
|
// Clear definitions at the end of export
|
||||||
definitions = null;
|
definitions = null;
|
||||||
return options && options.asString
|
return options.asString
|
||||||
? new XMLSerializer().serializeToString(svg)
|
? new XMLSerializer().serializeToString(svg)
|
||||||
: svg;
|
: svg;
|
||||||
}
|
}
|
||||||
|
@ -379,21 +379,22 @@ new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOptions(options) {
|
function setOptions(options) {
|
||||||
formatter = options && options.precision
|
if (!options)
|
||||||
? new Formatter(options.precision)
|
options = {};
|
||||||
: Formatter.instance;
|
formatter = new Formatter(options.precision);
|
||||||
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item.inject({
|
Item.inject({
|
||||||
exportSVG: function(options) {
|
exportSVG: function(options) {
|
||||||
setOptions(options);
|
options = setOptions(options);
|
||||||
return exportDefinitions(exportSVG(this), options);
|
return exportDefinitions(exportSVG(this), options);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Project.inject({
|
Project.inject({
|
||||||
exportSVG: function(options) {
|
exportSVG: function(options) {
|
||||||
setOptions(options);
|
options = setOptions(options);
|
||||||
var layers = this.layers,
|
var layers = this.layers,
|
||||||
size = this.view.getSize(),
|
size = this.view.getSize(),
|
||||||
node = createElement('svg', {
|
node = createElement('svg', {
|
||||||
|
|
Loading…
Reference in a new issue