More SVG code refactoring.

Follow coding conventions and fix some forgotten renamings.
This commit is contained in:
Jürg Lehni 2012-10-22 16:31:08 -07:00
parent 160095d6e3
commit d4a60fb62a
12 changed files with 378 additions and 381 deletions

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -12,8 +12,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -11,8 +11,8 @@
// strokeWidth: 2, // strokeWidth: 2,
// strokeCap: 'round' // strokeCap: 'round'
}; };
var isvg = new ImportSvg; var isvg = new ImportSvg();
isvg.importSVG(document.getElementById('svg')); isvg.importSvg(document.getElementById('svg'));
</script> </script>
</head> </head>
<body> <body>

View file

@ -111,23 +111,24 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
var pointArray; var pointArray;
var handleInArray; var handleInArray;
var handleOutArray; var handleOutArray;
var type;
//finding the type of path to export //finding the type of path to export
if(path.content) { if (path.content) {
type = 'text'; type = 'text';
} else { } else {
//Values are only defined if the path is not text because //Values are only defined if the path is not text because
// text does not have these values // text does not have these values
segArray = path.getSegments(); segArray = path.getSegments();
pointArray = new Array(); pointArray = [];
handleInArray = new Array(); handleInArray = [];
handleOutArray = new Array(); handleOutArray = [];
for (i = 0; i < segArray.length; i++) { for (i = 0; i < segArray.length; i++) {
pointArray[i] = segArray[i].getPoint(); pointArray[i] = segArray[i].getPoint();
handleInArray[i] = segArray[i].getHandleIn(); handleInArray[i] = segArray[i].getHandleIn();
handleOutArray[i] = segArray[i].getHandleOut(); handleOutArray[i] = segArray[i].getHandleOut();
} }
var exp = this; var exp = this;
var type = exp._determineType(path, segArray, pointArray, handleInArray, handleOutArray); type = exp._determineType(path, segArray, pointArray, handleInArray, handleOutArray);
} }
//switch statement that determines what type of SVG element to add to the SVG Object //switch statement that determines what type of SVG element to add to the SVG Object
switch (type) { switch (type) {
@ -204,13 +205,13 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
svgEle = document.createElementNS(this.NS, 'text'); svgEle = document.createElementNS(this.NS, 'text');
svgEle.setAttribute('x', path.getPoint().getX()); svgEle.setAttribute('x', path.getPoint().getX());
svgEle.setAttribute('y', path.getPoint().getY()); svgEle.setAttribute('y', path.getPoint().getY());
if(path.style.font != undefined) { if (path.style.font != undefined) {
svgEle.setAttribute('font', path.style.font); svgEle.setAttribute('font', path.style.font);
} }
if(path.characterStyle.font != undefined) { if (path.characterStyle.font != undefined) {
svgEle.setAttribute('font-family', path.characterStyle.font); svgEle.setAttribute('font-family', path.characterStyle.font);
} }
if(path.characterStyle.fontSize != undefined) { if (path.characterStyle.fontSize != undefined) {
svgEle.setAttribute('font-size',path.characterStyle.fontSize); svgEle.setAttribute('font-size',path.characterStyle.fontSize);
} }
svgEle.textContent = path.getContent(); svgEle.textContent = path.getContent();
@ -222,12 +223,12 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
} }
//If the object is a circle, ellipse, rectangle, or rounded rectangle, it will find the angle //If the object is a circle, ellipse, rectangle, or rounded rectangle, it will find the angle
//found by the determineIfTransformed method and make a path that accommodates for the transformed object //found by the determineIfTransformed method and make a path that accommodates for the transformed object
if(type != 'text' && type != undefined && type != 'polygon' && type != 'polyline' && type != 'line') { if (type != 'text' && type != undefined && type != 'polygon' && type != 'polyline' && type != 'line') {
//TODO: Need to implement exported transforms for circle, ellipse, and rectangles instead of //TODO: Need to implement exported transforms for circle, ellipse, and rectangles instead of
//making them paths //making them paths
var angle = this._determineIfTransformed(path, pointArray, type) + 90; var angle = this._determineIfTransformed(path, pointArray, type) + 90;
if(angle != 0) { if (angle != 0) {
if(type == 'rect' || type == 'roundRect') { if (type == 'rect' || type == 'roundRect') {
svgEle = document.createElementNS(this.NS, 'path'); svgEle = document.createElementNS(this.NS, 'path');
svgEle = this.pathSetup(path, pointArray, handleInArray, handleOutArray); svgEle = this.pathSetup(path, pointArray, handleInArray, handleOutArray);
} else { } else {
@ -236,10 +237,10 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
} }
} }
} }
if(type == 'text') { if (type == 'text') {
svgEle.setAttribute('transform','rotate(' + path.matrix.getRotation() + ',' + path.getPoint().getX() + ',' +path.getPoint().getY() +')'); svgEle.setAttribute('transform','rotate(' + path.matrix.getRotation() + ',' + path.getPoint().getX() + ',' +path.getPoint().getY() +')');
} }
if(path.id != undefined) { if (path.id != undefined) {
svgEle.setAttribute('id', path.id); svgEle.setAttribute('id', path.id);
} }
//checks if there is a stroke color in the passed in path //checks if there is a stroke color in the passed in path
@ -254,30 +255,30 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
svgEle.setAttribute('fill', 'rgba(0,0,0,0)'); svgEle.setAttribute('fill', 'rgba(0,0,0,0)');
} }
//same thing as stroke color except with stroke width //same thing as stroke color except with stroke width
if(path.strokeWidth != undefined){ if (path.strokeWidth != undefined) {
svgEle.setAttribute('stroke-width', path.strokeWidth); svgEle.setAttribute('stroke-width', path.strokeWidth);
} }
//same thing as stroke color except with the path name //same thing as stroke color except with the path name
if(path.name != undefined) { if (path.name != undefined) {
svgEle.setAttribute('name', path.name); svgEle.setAttribute('name', path.name);
} }
//same thing as stroke color except with the strokeCap //same thing as stroke color except with the strokeCap
if(path.strokeCap != undefined) { if (path.strokeCap != undefined) {
svgEle.setAttribute('stroke-linecap', path.strokeCap); svgEle.setAttribute('stroke-linecap', path.strokeCap);
} }
//same thing as stroke color except with the strokeJoin //same thing as stroke color except with the strokeJoin
if(path.strokeJoin != undefined) { if (path.strokeJoin != undefined) {
svgEle.setAttribute('stroke-linejoin', path.strokeJoin); svgEle.setAttribute('stroke-linejoin', path.strokeJoin);
} }
//same thing as stroke color except with the opacity //same thing as stroke color except with the opacity
if(path.opacity != undefined) { if (path.opacity != undefined) {
svgEle.setAttribute('opacity', path.opacity); svgEle.setAttribute('opacity', path.opacity);
} }
//checks to see if there the dashArray is set, then adds the attribute if there is. //checks to see if there the dashArray is set, then adds the attribute if there is.
if(path.dashArray[0] != undefined) { if (path.dashArray[0] != undefined) {
var dashVals = ''; var dashVals = '';
for (var i in path.dashArray) { for (var i in path.dashArray) {
if(i != path.dashArray.length -1) { if (i != path.dashArray.length -1) {
dashVals += path.dashArray[i] + ", "; dashVals += path.dashArray[i] + ", ";
} else { } else {
dashVals += path.dashArray[i]; dashVals += path.dashArray[i];
@ -286,17 +287,17 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
svgEle.setAttribute('stroke-dasharray', dashVals); svgEle.setAttribute('stroke-dasharray', dashVals);
} }
//same thing as stroke color except with the dash offset //same thing as stroke color except with the dash offset
if(path.dashOffset != undefined) { if (path.dashOffset != undefined) {
svgEle.setAttribute('stroke-dashoffset', path.dashOffset); svgEle.setAttribute('stroke-dashoffset', path.dashOffset);
} }
//same thing as stroke color except with the miter limit //same thing as stroke color except with the miter limit
if(path.miterLimit != undefined) { if (path.miterLimit != undefined) {
svgEle.setAttribute('stroke-miterlimit', path.miterLimit); svgEle.setAttribute('stroke-miterlimit', path.miterLimit);
} }
//same thing as stroke color except with the visibility //same thing as stroke color except with the visibility
if(path.visibility != undefined) { if (path.visibility != undefined) {
var visString = ''; var visString = '';
if(path.visibility) { if (path.visibility) {
visString = 'visible'; visString = 'visible';
} else { } else {
visString = 'hidden'; visString = 'hidden';
@ -362,7 +363,7 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
y2 = pointArray[i + 1].getY(); y2 = pointArray[i + 1].getY();
handleOut1 = hOArray[i]; handleOut1 = hOArray[i];
handleIn2 = hIArray[i+1]; handleIn2 = hIArray[i+1];
if(handleOut1.getX() == 0 && handleOut1.getY() == 0 && handleIn2.getX() == 0 && handleIn2.getY() ==0) { if (handleOut1.getX() == 0 && handleOut1.getY() == 0 && handleIn2.getX() == 0 && handleIn2.getY() ==0) {
//L is lineto, moving to a point with drawing //L is lineto, moving to a point with drawing
pointString+= 'L' + x2 + ',' + y2 + ' '; pointString+= 'L' + x2 + ',' + y2 + ' ';
} else { } else {
@ -410,7 +411,7 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
var curves = false; var curves = false;
var segHandleIn; var segHandleIn;
var segHandleOut; var segHandleOut;
for( var i in segArray){ for( var i in segArray) {
//Checks for any curves (if the handles have values). Differentiates between straight objects(line, polyline, rect, and polygon) and //Checks for any curves (if the handles have values). Differentiates between straight objects(line, polyline, rect, and polygon) and
//and objects with curves(circle, ellipse, roundedRectangle). //and objects with curves(circle, ellipse, roundedRectangle).
segHandleIn = segArray[i].getHandleIn(); segHandleIn = segArray[i].getHandleIn();
@ -421,46 +422,46 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{
//Checks for curves in the passed in segments //Checks for curves in the passed in segments
//Checks if the type of the passed in path is a rounded rectangle, an ellipse, a circle, or if it's simply a path //Checks if the type of the passed in path is a rounded rectangle, an ellipse, a circle, or if it's simply a path
//If there aren't any curves (if curves = false), then it checks if the type is a rectangle, a polygon, a polyline, or simply a line. //If there aren't any curves (if curves = false), then it checks if the type is a rectangle, a polygon, a polyline, or simply a line.
if(curves){ if (curves) {
if(segArray.length == 8) { if (segArray.length == 8) {
//if the distance between (point0 and point3) and (point7 and point4) are equal then it is a roundedRectangle //if the distance between (point0 and point3) and (point7 and point4) are equal then it is a roundedRectangle
dPoint12 = Math.round(pointArray[0].getDistance(pointArray[3], false)); dPoint12 = Math.round(pointArray[0].getDistance(pointArray[3], false));
dPoint34 = Math.round(pointArray[7].getDistance(pointArray[4], false)); dPoint34 = Math.round(pointArray[7].getDistance(pointArray[4], false));
if(dPoint12 == dPoint34) { if (dPoint12 == dPoint34) {
type = 'roundRect'; type = 'roundRect';
} }
} else if(segArray.length == 4) { } else if (segArray.length == 4) {
//checks if the values of the point have values similar to circles and ellipses //checks if the values of the point have values similar to circles and ellipses
var checkPointValues = true; var checkPointValues = true;
for(i = 0; i < pointArray.length && checkPointValues == true; i++) { for(i = 0; i < pointArray.length && checkPointValues == true; i++) {
if(handleInArray[i].getX() != 0 || handleInArray[i].getY() != 0 && Math.round(Math.abs(handleInArray[i].getX())) === Math.round(Math.abs(handleOutArray[i].getX())) && Math.round(Math.abs(handleInArray[i].getY())) === Math.round(Math.abs(handleOutArray[i].getY()))) { if (handleInArray[i].getX() != 0 || handleInArray[i].getY() != 0 && Math.round(Math.abs(handleInArray[i].getX())) === Math.round(Math.abs(handleOutArray[i].getX())) && Math.round(Math.abs(handleInArray[i].getY())) === Math.round(Math.abs(handleOutArray[i].getY()))) {
checkPointValues = true; checkPointValues = true;
} else { } else {
checkPointValues = false; checkPointValues = false;
} }
} }
if(checkPointValues == true) { if (checkPointValues == true) {
//if the distance between (point0 and point2) and (point1 and point3) are equal, then it is a circle //if the distance between (point0 and point2) and (point1 and point3) are equal, then it is a circle
var d1 = Math.round(pointArray[0].getDistance(pointArray[2], false)); var d1 = Math.round(pointArray[0].getDistance(pointArray[2], false));
var d2 = Math.round(pointArray[1].getDistance(pointArray[3], false)); var d2 = Math.round(pointArray[1].getDistance(pointArray[3], false));
if(d1 == d2) { if (d1 == d2) {
type = 'circle'; type = 'circle';
} else { } else {
type = 'ellipse'; type = 'ellipse';
} }
} }
} }
} else if(!curves) { } else if (!curves) {
if(segArray.length == 4) { if (segArray.length == 4) {
//if the distance between (point0 and point1) and (point2 and point3) are equal, then it is a rectangle //if the distance between (point0 and point1) and (point2 and point3) are equal, then it is a rectangle
dPoint12 = Math.round(pointArray[0].getDistance(pointArray[1], false)); dPoint12 = Math.round(pointArray[0].getDistance(pointArray[1], false));
dPoint34 = Math.round(pointArray[3].getDistance(pointArray[2], false)); dPoint34 = Math.round(pointArray[3].getDistance(pointArray[2], false));
if(dPoint12 == dPoint34) { if (dPoint12 == dPoint34) {
type = 'rect'; type = 'rect';
} }
} else if(segArray.length >= 3) { } else if (segArray.length >= 3) {
//If it is an object with more than 3 segments and the path is closed, it is a polygon //If it is an object with more than 3 segments and the path is closed, it is a polygon
if(path.getClosed()) { if (path.getClosed()) {
type = 'polygon'; type = 'polygon';
} else { } else {
type = 'polyline'; type = 'polyline';

View file

@ -39,7 +39,7 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{
* @param {SVG DOM} svg An SVG DOM object with parameters * @param {SVG DOM} svg An SVG DOM object with parameters
* @return {item} A Paper.js layer * @return {item} A Paper.js layer
*/ */
importSVG: function(svg) { importSvg: function(svg) {
var item; var item;
var symbol; var symbol;
switch (svg.nodeName.toLowerCase()) { switch (svg.nodeName.toLowerCase()) {
@ -75,12 +75,11 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{
symbol = new Symbol(item); symbol = new Symbol(item);
item = null; item = null;
default: default:
//Not supported yet. // Not supported yet.
} }
if (item) { if (item)
this._importAttributesAndStyles(svg, item); this._importAttributesAndStyles(svg, item);
}
return item; return item;
}, },
@ -101,14 +100,12 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{
var child; var child;
for (var i in svg.childNodes) { for (var i in svg.childNodes) {
child = svg.childNodes[i]; child = svg.childNodes[i];
if (child.nodeType != 1) { if (child.nodeType != 1)
continue; continue;
} item = this.importSvg(child);
item = this.importSVG(child); if (item)
if (item) {
group.addChild(item); group.addChild(item);
} }
}
return group; return group;
}, },
@ -282,7 +279,7 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{
var controlPoint; var controlPoint;
var prevCommand; var prevCommand;
var segmentTo; var segmentTo;
for (var i = 0; i < segments.numberOfItems; ++i){ for (var i = 0; i < segments.numberOfItems; ++i) {
segment = segments.getItem(i); segment = segments.getItem(i);
if (segment.pathSegType == SVGPathSeg.PATHSEG_UNKNOWN) { if (segment.pathSegType == SVGPathSeg.PATHSEG_UNKNOWN) {
continue; continue;
@ -554,7 +551,6 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{
break; break;
case SVGTransform.SVG_TRANSFORM_SCALE: case SVGTransform.SVG_TRANSFORM_SCALE:
break; break;
//Compensate for SVG's theta rotation going the opposite direction //Compensate for SVG's theta rotation going the opposite direction
case SVGTransform.SVG_TRANSFORM_MATRIX: case SVGTransform.SVG_TRANSFORM_MATRIX:
var temp = transformMatrix.getShearX(); var temp = transformMatrix.getShearX();

View file

@ -31,7 +31,7 @@ test('make an svg line', function() {
shape.setAttribute('y2', y2); shape.setAttribute('y2', y2);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedLine = isvg.importSVG(shape); var importedLine = isvg.importSvg(shape);
var line = new Path.Line([x1, y1], [x2, y2]); var line = new Path.Line([x1, y1], [x2, y2]);
@ -47,7 +47,7 @@ test('make an svg line with invalid values', function() {
shape.setAttribute('y2', null); shape.setAttribute('y2', null);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedLine = isvg.importSVG(shape); var importedLine = isvg.importSvg(shape);
var line = new Path.Line([0, 0], [0, 0]); var line = new Path.Line([0, 0], [0, 0]);
@ -68,7 +68,7 @@ test('compare rectangle values', function() {
shape.setAttribute('height', height); shape.setAttribute('height', height);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -92,7 +92,7 @@ test('compare negative rectangle values', function() {
shape.setAttribute('height', height); shape.setAttribute('height', height);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
var rectangle = new Rectangle(topLeft, size); var rectangle = new Rectangle(topLeft, size);
@ -112,7 +112,7 @@ test('compare invalid rectangle values', function() {
shape.setAttribute('height', null); shape.setAttribute('height', null);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(0, 0); var topLeft = new Point(0, 0);
var size = new Size(0, 0); var size = new Size(0, 0);
@ -139,7 +139,7 @@ test('compare round rectangle values', function() {
shape.setAttribute('height', height); shape.setAttribute('height', height);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -167,7 +167,7 @@ test('compare negative round rectangle values', function() {
shape.setAttribute('height', height); shape.setAttribute('height', height);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -195,7 +195,7 @@ test('compare invalid round rectangle values', function() {
shape.setAttribute('height', height); shape.setAttribute('height', height);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedRectangle = isvg.importSVG(shape); var importedRectangle = isvg.importSvg(shape);
var topLeft = new Point(x, y); var topLeft = new Point(x, y);
var size = new Size(width, height); var size = new Size(width, height);
@ -219,7 +219,7 @@ test('compare oval values', function() {
shape.setAttribute('ry', ry); shape.setAttribute('ry', ry);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedOval = isvg.importSVG(shape); var importedOval = isvg.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var offset = new Point(rx, ry); var offset = new Point(rx, ry);
@ -247,7 +247,7 @@ test('compare negative oval values', function() {
shape.setAttribute('ry', ry); shape.setAttribute('ry', ry);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedOval = isvg.importSVG(shape); var importedOval = isvg.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var offset = new Point(rx, ry); var offset = new Point(rx, ry);
@ -270,7 +270,7 @@ test('compare invalid oval values', function() {
shape.setAttribute('ry', null); shape.setAttribute('ry', null);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedOval = isvg.importSVG(shape); var importedOval = isvg.importSvg(shape);
var center = new Point(0, 0); var center = new Point(0, 0);
var offset = new Point(0, 0); var offset = new Point(0, 0);
@ -295,7 +295,7 @@ test('compare circle values', function() {
shape.setAttribute('r', r); shape.setAttribute('r', r);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedCircle = isvg.importSVG(shape); var importedCircle = isvg.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var circle = new Path.Circle(center, r); var circle = new Path.Circle(center, r);
@ -315,7 +315,7 @@ test('compare negative circle values', function() {
shape.setAttribute('r', r); shape.setAttribute('r', r);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedCircle = isvg.importSVG(shape); var importedCircle = isvg.importSvg(shape);
var center = new Point(cx, cy); var center = new Point(cx, cy);
var circle = new Path.Circle(center, r); var circle = new Path.Circle(center, r);
@ -333,7 +333,7 @@ test('compare invalid circle values', function() {
shape.setAttribute('r', null); shape.setAttribute('r', null);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedCircle = isvg.importSVG(shape); var importedCircle = isvg.importSvg(shape);
var center = new Point(0, 0); var center = new Point(0, 0);
var circle = new Path.Circle(center, 0); var circle = new Path.Circle(center, 0);
@ -349,7 +349,7 @@ test('compare polygon values', function() {
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedPolygon = isvg.importSVG(shape); var importedPolygon = isvg.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -376,7 +376,7 @@ test('compare negative polygon values', function() {
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedPolygon = isvg.importSVG(shape); var importedPolygon = isvg.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -403,7 +403,7 @@ test('compare polyline values', function() {
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedPolyline = isvg.importSVG(shape); var importedPolyline = isvg.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;
@ -430,7 +430,7 @@ test('compare polyline values', function() {
shape.setAttribute('points', svgpoints); shape.setAttribute('points', svgpoints);
var isvg = new ImportSvg(); var isvg = new ImportSvg();
var importedPolyline = isvg.importSVG(shape); var importedPolyline = isvg.importSvg(shape);
var poly = new Path(); var poly = new Path();
var points = shape.points; var points = shape.points;