mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Rename ImportSvg to SvgImporter, and ExportSvg to SvgExporter.
This commit is contained in:
parent
ab02023adf
commit
1ce332756e
24 changed files with 80 additions and 80 deletions
|
@ -28,7 +28,7 @@
|
|||
var path = new Path.Circle(new Point(50, 50), 25);
|
||||
path.fillColor = 'red';
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
var path2 = new Path(segments);
|
||||
path2.strokeColor = 'yellow';
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
line3.strokeColor = "yellow";
|
||||
line3.strokeWidth = "5";
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
var path = new Path.Star(center, points, radius1, radius2);
|
||||
path.fillColor = 'black';
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
path4.strokeColor= 'yellow';
|
||||
path4.fillColor='purple';
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
c.fillColor = colors[i];
|
||||
}
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
test.appendChild (output);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
clonedPath.rotate(angle * i, circlePath.bounds.topLeft);
|
||||
};
|
||||
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
console.log(output);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
copy.strokeColor = 'red';
|
||||
copy.rotate(-45);
|
||||
copy.scale(0.5);
|
||||
var output = ExportSvg.exportProject(paper.project);
|
||||
var output = SvgExporter.exportProject(paper.project);
|
||||
var test = document.getElementById('svg')
|
||||
test.innerHTML = "";
|
||||
test.appendChild (output);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// strokeWidth: 2,
|
||||
// strokeCap: 'round'
|
||||
};
|
||||
ImportSvg.importSvg(document.getElementById('svg'));
|
||||
SvgImporter.importSvg(document.getElementById('svg'));
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -93,8 +93,8 @@ var paper = new function() {
|
|||
/*#*/ include('text/TextItem.js');
|
||||
/*#*/ include('text/PointText.js');
|
||||
|
||||
/*#*/ include('svg/ExportSvg.js');
|
||||
/*#*/ include('svg/ImportSvg.js');
|
||||
/*#*/ include('svg/SvgExporter.js');
|
||||
/*#*/ include('svg/SvgImporter.js');
|
||||
|
||||
/*#*/ include('style/Style.js');
|
||||
/*#*/ include('style/PathStyle.js');
|
||||
|
|
|
@ -127,6 +127,7 @@ Path.inject({ statics: new function() {
|
|||
var _rect = Rectangle.read(arguments),
|
||||
_size = Size.read(arguments);
|
||||
if (_size.isZero())
|
||||
// No need for new, since constructors here do so themselves.
|
||||
return Path.Rectangle(rect);
|
||||
_size = Size.min(_size, _rect.getSize(true).divide(2));
|
||||
var bl = _rect.getBottomLeft(true),
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @name ExportSvg
|
||||
* @name SvgExporter
|
||||
*
|
||||
* @class The ExportSvg object holds all the functionality to convert a Paper.js
|
||||
* @class The SvgExporter object holds all the functionality to convert a Paper.js
|
||||
* DOM to a SVG DOM.
|
||||
*
|
||||
*/
|
||||
|
||||
var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
|
||||
var SvgExporter = this.SvgExporter = /** @Lends SvgExporter */{
|
||||
|
||||
create: function(tag) {
|
||||
return document.createElementNS('http://www.w3.org/2000/svg', tag);
|
||||
|
@ -55,7 +55,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
|
|||
* Takes the selected Paper.js layer and parses all groups
|
||||
* and items on the layer into one SVG
|
||||
*
|
||||
* @name ExportSvg#exportLayer
|
||||
* @name SvgExporter#exportLayer
|
||||
* @function
|
||||
* @param {Layer} layer a Paper.js layer
|
||||
* @return {SVGSVGElement} the layer converted into an SVG group
|
||||
|
@ -68,7 +68,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
|
|||
*
|
||||
* Takes a Paper.js group and puts its items in a SVG file.
|
||||
*
|
||||
* @name ExportSvg#exportGroup
|
||||
* @name SvgExporter#exportGroup
|
||||
* @function
|
||||
* @param {Group} group a Paper.js group
|
||||
* @return {SVGSVGElement} an SVG object
|
||||
|
@ -92,7 +92,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
|
|||
* Takes the path and puts it in
|
||||
* a svg file.
|
||||
*
|
||||
* @name ExportSvg#exportPath
|
||||
* @name SvgExporter#exportPath
|
||||
* @function
|
||||
* @param {Path} path a Paper.js path object
|
||||
* @return {SVGSVGElement} an SVG object of the imported path
|
||||
|
@ -390,7 +390,7 @@ var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{
|
|||
/**
|
||||
* Checks the type SVG object created by converting from Paper.js
|
||||
*
|
||||
* @name ExportSvg#checkType
|
||||
* @name SvgExporter#checkType
|
||||
* @function
|
||||
* @param {Array} segArray An array of objects for the newly
|
||||
* converted SVG object
|
|
@ -20,15 +20,15 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @name ImportSvg
|
||||
* @class The ImportSvg object represents an object created using the SVG
|
||||
* @name SvgImporter
|
||||
* @class The SvgImporter object represents an object created using the SVG
|
||||
* Canvas that will be converted into a Paper.js object.
|
||||
* The SVG object is imported into Paper.js by converting it into items
|
||||
* within groups.
|
||||
*
|
||||
*/
|
||||
|
||||
var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
||||
var SvgImporter = this.SvgImporter = /** @Lends SvgImporter */{
|
||||
/**
|
||||
* Creates a Paper.js object using data parsed from the selected
|
||||
* SVG Document Object Model (DOM). The SVG object is imported,
|
||||
|
@ -72,16 +72,15 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
case 'symbol':
|
||||
item = this._importGroup(svg);
|
||||
this._importAttributesAndStyles(svg, item);
|
||||
// TODO: We're no returning symbol. How to handle this?
|
||||
symbol = new Symbol(item);
|
||||
item = null;
|
||||
break;
|
||||
default:
|
||||
// Not supported yet.
|
||||
}
|
||||
|
||||
if (item)
|
||||
this._importAttributesAndStyles(svg, item);
|
||||
|
||||
return item;
|
||||
},
|
||||
|
||||
|
@ -89,7 +88,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* Creates a Paper.js group by parsing a specific GNode of the
|
||||
* imported SVG DOM
|
||||
*
|
||||
* @name ImportSvg#importGroup
|
||||
* @name SvgImporter#importGroup
|
||||
* @function
|
||||
* @param {XML DOM} svg A node passed in by the imported SVG
|
||||
* @return {Group} group A Paper.js group
|
||||
|
@ -115,7 +114,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* Creates a Path.Circle item in Paper.js using an imported
|
||||
* Circle from SVG
|
||||
*
|
||||
* @name ImportSvg#importCircle
|
||||
* @name SvgImporter#importCircle
|
||||
* @function
|
||||
* @param {XML DOM} svgCircle An SVG circle node
|
||||
* @return {Path.Circle} circle A Path.Circle item for Paper.js
|
||||
|
@ -134,7 +133,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
/**
|
||||
* Creates a Path.Oval item in Paper.js using an imported Oval from SVG
|
||||
*
|
||||
* @name ImportSvg#importOval
|
||||
* @name SvgImporter#importOval
|
||||
* @function
|
||||
* @param {XML DOM} svgOval An SVG ellipse node
|
||||
* @return {Path.Oval} oval A Path.Oval item for Paper.js
|
||||
|
@ -159,7 +158,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
/**
|
||||
* Creates a Path.Rectangle item from an imported SVG rectangle
|
||||
*
|
||||
* @name ImportSvg#importRectangle
|
||||
* @name SvgImporter#importRectangle
|
||||
* @function
|
||||
* @param {XML DOM} svgRectangle An SVG rectangle node
|
||||
* @return {Path.Rectangle} rectangle A Path.Rectangle item for
|
||||
|
@ -169,7 +168,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* Creates a Path.RoundRectangle item from an imported SVG
|
||||
* rectangle with rounded corners
|
||||
*
|
||||
* @name ImportSvg#importRectangle
|
||||
* @name SvgImporter#importRectangle
|
||||
* @function
|
||||
* @param {XML DOM} svgRectangle An SVG rectangle node with
|
||||
* rounded corners
|
||||
|
@ -201,7 +200,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
/**
|
||||
* Creates a Path.Line item in Paper.js from an imported SVG line
|
||||
*
|
||||
* @name ImportSvg#importLine
|
||||
* @name SvgImporter#importLine
|
||||
* @function
|
||||
* @param {XML DOM} svgLine An SVG line node
|
||||
* @return {Path.Line} line A Path.Line item for Paper.js
|
||||
|
@ -222,7 +221,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
/**
|
||||
* Creates a PointText item in Paper.js from an imported SVG text node
|
||||
*
|
||||
* @name ImportSvg#importText
|
||||
* @name SvgImporter#importText
|
||||
* @function
|
||||
* @param {XML DOM} svgText An SVG text node
|
||||
* @return {Path.Text} text A PointText item for Paper.js
|
||||
|
@ -266,7 +265,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* a specific SVG node (rectangle, path, circle, polygon, etc.)
|
||||
* and creating the right Path object based on the SVG type.
|
||||
*
|
||||
* @name ImportSvg#importPath
|
||||
* @name SvgImporter#importPath
|
||||
* @function
|
||||
* @param {XML DOM} svg An SVG object
|
||||
* @return {Item} item A Paper.js item
|
||||
|
@ -372,7 +371,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* Creates a Path.Poly item in Paper.js using an imported Polygon or
|
||||
* Polyline SVG node
|
||||
*
|
||||
* @name ImportSvg#importPoly
|
||||
* @name SvgImporter#importPoly
|
||||
* @function
|
||||
* @param {XML DOM} svgPoly An SVG polygon or polyline node
|
||||
* @return {Path.Poly} poly A Path.Poly item for Paper.js
|
||||
|
@ -403,7 +402,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* attributes
|
||||
* This method is destructive to item (changes happen to it)
|
||||
*
|
||||
* @name ImportSvg#importAttributesAndStyles
|
||||
* @name SvgImporter#importAttributesAndStyles
|
||||
* @function
|
||||
* @param {XML DOM} svg An SVG node
|
||||
* @param {Item} item A Paper.js item
|
||||
|
@ -431,7 +430,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* Parses an SVG style attibute and applies it to a Paper.js item
|
||||
* This method is destructive to item (changes happen to it)
|
||||
*
|
||||
* @name ImportSvg#applyAttributeOrStyle
|
||||
* @name SvgImporter#applyAttributeOrStyle
|
||||
* @function
|
||||
* @param {Style Name} name An SVG style name
|
||||
* @param {Style Value} value The value of an SVG style
|
||||
|
@ -526,7 +525,7 @@ var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{
|
|||
* made Paper.js item
|
||||
* This method is destructive to item
|
||||
*
|
||||
* @name ImportSvg#applyTransform
|
||||
* @name SvgImporter#applyTransform
|
||||
* @function
|
||||
* @param {XML DOM} An SVG node
|
||||
* @param {Item} A Paper.js item
|
|
@ -16,7 +16,7 @@
|
|||
* This test file created by Stetson-Team-Alpha
|
||||
*/
|
||||
|
||||
module('ExportSvg');
|
||||
module('SvgExporter');
|
||||
|
||||
test('compare line path functions', function() {
|
||||
var svgns = 'http://www.w3.org/2000/svg';
|
||||
|
@ -32,7 +32,7 @@ test('compare line path functions', function() {
|
|||
|
||||
var line = new Path.Line([x1, y1], [x2, y2]);
|
||||
|
||||
var exportedLine = ExportSvg.exportPath(line);
|
||||
var exportedLine = SvgExporter.exportPath(line);
|
||||
|
||||
var shapex1 = shape.getAttribute('x1');
|
||||
var shapey1 = shape.getAttribute('y1');
|
||||
|
@ -65,7 +65,7 @@ test('compare negative line path functions', function() {
|
|||
|
||||
var line = new Path.Line([x1, y1], [x2, y2]);
|
||||
|
||||
var exportedLine = ExportSvg.exportPath(line);
|
||||
var exportedLine = SvgExporter.exportPath(line);
|
||||
|
||||
var shapex1 = shape.getAttribute('x1');
|
||||
var shapey1 = shape.getAttribute('y1');
|
||||
|
@ -98,7 +98,7 @@ test('compare invalid line path functions', function() {
|
|||
|
||||
var line = new Path.Line([x1, y1], [x2, y2]);
|
||||
|
||||
var exportedLine = ExportSvg.exportPath(line);
|
||||
var exportedLine = SvgExporter.exportPath(line);
|
||||
|
||||
var shapex1 = shape.getAttribute('x1');
|
||||
var shapey1 = shape.getAttribute('y1');
|
||||
|
@ -133,7 +133,7 @@ test('compare invalid line path functions', function() {
|
|||
var size = new Size(100, 100);
|
||||
var path = new Path.Rectangle(point, size);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(path);
|
||||
var exportedRectangle = SvgExporter.exportPath(path);
|
||||
|
||||
var shapex1 = shape.getAttribute('x');
|
||||
var shapey1 = shape.getAttribute('y1');
|
||||
|
@ -168,7 +168,7 @@ test('compare negative rectangle values', function() {
|
|||
var size = new Size(width, height);
|
||||
var rect = new Rectangle(topLeft, size);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(rect);
|
||||
var exportedRectangle = SvgExporter.exportPath(rect);
|
||||
|
||||
var shapex = shape.getAttribute('x');
|
||||
var shapey = shape.getAttribute('y');
|
||||
|
@ -202,7 +202,7 @@ test('compare invalid rectangle values', function() {
|
|||
var size = new Size(width, height);
|
||||
var rect = new Rectangle(topLeft, size);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(rect);
|
||||
var exportedRectangle = SvgExporter.exportPath(rect);
|
||||
|
||||
var shapex = shape.getAttribute('x');
|
||||
var shapey = shape.getAttribute('y');
|
||||
|
@ -242,7 +242,7 @@ test('compare rounded rectangle values', function() {
|
|||
var rect = new Rectangle(topLeft, size);
|
||||
var roundRect = new Path.RoundRectangle(rect, cornerSize);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(rect);
|
||||
var exportedRectangle = SvgExporter.exportPath(rect);
|
||||
|
||||
var shapex = shape.getAttribute('x');
|
||||
var shapey = shape.getAttribute('y');
|
||||
|
@ -286,7 +286,7 @@ test('compare negative rounded rectangle values', function() {
|
|||
var rect = new Rectangle(topLeft, size);
|
||||
var roundRect = new Path.RoundRectangle(rect, cornerSize);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(rect);
|
||||
var exportedRectangle = SvgExporter.exportPath(rect);
|
||||
|
||||
var shapex = shape.getAttribute('x');
|
||||
var shapey = shape.getAttribute('y');
|
||||
|
@ -330,7 +330,7 @@ test('compare invalid rounded rectangle values', function() {
|
|||
var rect = new Rectangle(topLeft, size);
|
||||
var roundRect = new Path.RoundRectangle(rect, cornerSize);
|
||||
|
||||
var exportedRectangle = ExportSvg.exportPath(rect);
|
||||
var exportedRectangle = SvgExporter.exportPath(rect);
|
||||
|
||||
var shapex = shape.getAttribute('x');
|
||||
var shapey = shape.getAttribute('y');
|
||||
|
@ -372,7 +372,7 @@ test('compare oval values', function() {
|
|||
var rect = new Rectangle(topLeft, bottomRight);
|
||||
var oval = new Path.Oval(rect);
|
||||
|
||||
var exportedOval = ExportSvg.exportPath(oval);
|
||||
var exportedOval = SvgExporter.exportPath(oval);
|
||||
|
||||
var shapecx = shape.getAttribute('cx');
|
||||
var shapecy = shape.getAttribute('cy');
|
||||
|
@ -404,7 +404,7 @@ test('compare circle values', function() {
|
|||
var center = new Point(cx, cy);
|
||||
var circle = new Path.Circle(center, r);
|
||||
|
||||
var exportedCircle = ExportSvg.exportPath(circle);
|
||||
var exportedCircle = SvgExporter.exportPath(circle);
|
||||
|
||||
var shapecx = shape.getAttribute('cx');
|
||||
var shapecy = shape.getAttribute('cy');
|
||||
|
@ -440,7 +440,7 @@ test('compare polygon values', function() {
|
|||
poly.closePath();
|
||||
}
|
||||
|
||||
var exportedPolygon = ExportSvg.exportPath(poly);
|
||||
var exportedPolygon = SvgExporter.exportPath(poly);
|
||||
|
||||
var svgPoints = shape.getAttribute('points');
|
||||
|
||||
|
@ -470,7 +470,7 @@ test('compare negative polygon values', function() {
|
|||
poly.closePath();
|
||||
}
|
||||
|
||||
var exportedPolygon = ExportSvg.exportPath(poly);
|
||||
var exportedPolygon = SvgExporter.exportPath(poly);
|
||||
|
||||
var svgPoints = shape.getAttribute('points');
|
||||
|
||||
|
@ -500,7 +500,7 @@ test('compare polyline values', function() {
|
|||
poly.closePath();
|
||||
}
|
||||
|
||||
var exportedPolygon = ExportSvg.exportPath(poly);
|
||||
var exportedPolygon = SvgExporter.exportPath(poly);
|
||||
|
||||
var svgPoints = shape.getAttribute('points');
|
||||
|
||||
|
@ -530,7 +530,7 @@ test('compare negative polyline values', function() {
|
|||
poly.closePath();
|
||||
}
|
||||
|
||||
var exportedPolygon = ExportSvg.exportPath(poly);
|
||||
var exportedPolygon = SvgExporter.exportPath(poly);
|
||||
|
||||
var svgPoints = shape.getAttribute('points');
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* This test file created by Stetson-Team-Alpha
|
||||
*/
|
||||
|
||||
module('ImportSvg');
|
||||
module('SvgImporter');
|
||||
|
||||
test('make an svg line', function() {
|
||||
var svgns = 'http://www.w3.org/2000/svg';
|
||||
|
@ -30,7 +30,7 @@ test('make an svg line', function() {
|
|||
shape.setAttribute('x2', x2);
|
||||
shape.setAttribute('y2', y2);
|
||||
|
||||
var importedLine = ImportSvg.importSvg(shape);
|
||||
var importedLine = SvgImporter.importSvg(shape);
|
||||
|
||||
var line = new Path.Line([x1, y1], [x2, y2]);
|
||||
|
||||
|
@ -45,7 +45,7 @@ test('make an svg line with invalid values', function() {
|
|||
shape.setAttribute('x2', null);
|
||||
shape.setAttribute('y2', null);
|
||||
|
||||
var importedLine = ImportSvg.importSvg(shape);
|
||||
var importedLine = SvgImporter.importSvg(shape);
|
||||
|
||||
var line = new Path.Line([0, 0], [0, 0]);
|
||||
|
||||
|
@ -64,7 +64,7 @@ test('compare rectangle values', function() {
|
|||
shape.setAttribute('width', width);
|
||||
shape.setAttribute('height', height);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
|
||||
var topLeft = new Point(x, y);
|
||||
var size = new Size(width, height);
|
||||
|
@ -87,7 +87,7 @@ test('compare negative rectangle values', function() {
|
|||
shape.setAttribute('width', width);
|
||||
shape.setAttribute('height', height);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
var topLeft = new Point(x, y);
|
||||
var size = new Size(width, height);
|
||||
var rectangle = new Rectangle(topLeft, size);
|
||||
|
@ -106,7 +106,7 @@ test('compare invalid rectangle values', function() {
|
|||
shape.setAttribute('width', null);
|
||||
shape.setAttribute('height', null);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
|
||||
var topLeft = new Point(0, 0);
|
||||
var size = new Size(0, 0);
|
||||
|
@ -132,7 +132,7 @@ test('compare round rectangle values', function() {
|
|||
shape.setAttribute('width', width);
|
||||
shape.setAttribute('height', height);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
|
||||
var topLeft = new Point(x, y);
|
||||
var size = new Size(width, height);
|
||||
|
@ -159,7 +159,7 @@ test('compare negative round rectangle values', function() {
|
|||
shape.setAttribute('width', width);
|
||||
shape.setAttribute('height', height);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
|
||||
var topLeft = new Point(x, y);
|
||||
var size = new Size(width, height);
|
||||
|
@ -186,7 +186,7 @@ test('compare invalid round rectangle values', function() {
|
|||
shape.setAttribute('width', width);
|
||||
shape.setAttribute('height', height);
|
||||
|
||||
var importedRectangle = ImportSvg.importSvg(shape);
|
||||
var importedRectangle = SvgImporter.importSvg(shape);
|
||||
|
||||
var topLeft = new Point(x, y);
|
||||
var size = new Size(width, height);
|
||||
|
@ -209,7 +209,7 @@ test('compare oval values', function() {
|
|||
shape.setAttribute('rx', rx);
|
||||
shape.setAttribute('ry', ry);
|
||||
|
||||
var importedOval = ImportSvg.importSvg(shape);
|
||||
var importedOval = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(cx, cy);
|
||||
var offset = new Point(rx, ry);
|
||||
|
@ -234,7 +234,7 @@ test('compare negative oval values', function() {
|
|||
shape.setAttribute('rx', rx);
|
||||
shape.setAttribute('ry', ry);
|
||||
|
||||
var importedOval = ImportSvg.importSvg(shape);
|
||||
var importedOval = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(cx, cy);
|
||||
var offset = new Point(rx, ry);
|
||||
|
@ -255,7 +255,7 @@ test('compare invalid oval values', function() {
|
|||
shape.setAttribute('rx', null);
|
||||
shape.setAttribute('ry', null);
|
||||
|
||||
var importedOval = ImportSvg.importSvg(shape);
|
||||
var importedOval = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(0, 0);
|
||||
var offset = new Point(0, 0);
|
||||
|
@ -278,7 +278,7 @@ test('compare circle values', function() {
|
|||
shape.setAttribute('cy', cy);
|
||||
shape.setAttribute('r', r);
|
||||
|
||||
var importedCircle = ImportSvg.importSvg(shape);
|
||||
var importedCircle = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(cx, cy);
|
||||
var circle = new Path.Circle(center, r);
|
||||
|
@ -296,7 +296,7 @@ test('compare negative circle values', function() {
|
|||
shape.setAttribute('cy', cy);
|
||||
shape.setAttribute('r', r);
|
||||
|
||||
var importedCircle = ImportSvg.importSvg(shape);
|
||||
var importedCircle = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(cx, cy);
|
||||
var circle = new Path.Circle(center, r);
|
||||
|
@ -312,7 +312,7 @@ test('compare invalid circle values', function() {
|
|||
shape.setAttribute('cy', null);
|
||||
shape.setAttribute('r', null);
|
||||
|
||||
var importedCircle = ImportSvg.importSvg(shape);
|
||||
var importedCircle = SvgImporter.importSvg(shape);
|
||||
|
||||
var center = new Point(0, 0);
|
||||
var circle = new Path.Circle(center, 0);
|
||||
|
@ -327,7 +327,7 @@ test('compare polygon values', function() {
|
|||
var svgpoints = "100,10 40,180 190,60 10,60 160,180";
|
||||
shape.setAttribute('points', svgpoints);
|
||||
|
||||
var importedPolygon = ImportSvg.importSvg(shape);
|
||||
var importedPolygon = SvgImporter.importSvg(shape);
|
||||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
|
@ -352,7 +352,7 @@ test('compare negative polygon values', function() {
|
|||
var svgpoints = "-100,-10 -40,-180 -190,-60 -10,-60 -160,-180";
|
||||
shape.setAttribute('points', svgpoints);
|
||||
|
||||
var importedPolygon = ImportSvg.importSvg(shape);
|
||||
var importedPolygon = SvgImporter.importSvg(shape);
|
||||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
|
@ -377,7 +377,7 @@ test('compare polyline values', function() {
|
|||
var svgpoints = "5,5 45,45 5,45 45,5";
|
||||
shape.setAttribute('points', svgpoints);
|
||||
|
||||
var importedPolyline = ImportSvg.importSvg(shape);
|
||||
var importedPolyline = SvgImporter.importSvg(shape);
|
||||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
||||
|
@ -402,7 +402,7 @@ test('compare negative polyline values', function() {
|
|||
var svgpoints = "-5,-5 -45,-45 -5,-45 -45,-5";
|
||||
shape.setAttribute('points', svgpoints);
|
||||
|
||||
var importedPolyline = ImportSvg.importSvg(shape);
|
||||
var importedPolyline = SvgImporter.importSvg(shape);
|
||||
|
||||
var poly = new Path();
|
||||
var points = shape.points;
|
|
@ -28,5 +28,5 @@
|
|||
|
||||
/*#*/ include('HitResult.js');
|
||||
|
||||
/*#*/ include('ImportSvg.js');
|
||||
/*#*/ include('ExportSvg.js');
|
||||
/*#*/ include('SvgImporter.js');
|
||||
/*#*/ include('SvgExporter.js');
|
||||
|
|
Loading…
Reference in a new issue