From 69dc8be629d48c36ee4611e62774695c5aee0780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 2 Nov 2012 16:19:45 -0700 Subject: [PATCH] Switch from using classes to object literals for SVG exporter / importer. --- examples/SVG Export/Circle Testing.html | 3 +- examples/SVG Export/Empty Path Testing.html | 4 +- examples/SVG Export/Line Testing.html | 3 +- examples/SVG Export/Random Path Testing.html | 3 +- .../Rect and Attribute Testing.html | 3 +- examples/SVG Export/Text Testing.html | 5 +- examples/SVG Export/Transform Test 1.html | 5 +- examples/SVG Export/Transform Test 2.html | 3 +- .../SVG Import/Circle and Oval Testing.html | 3 +- examples/SVG Import/Line Testing.html | 3 +- .../SVG Import/Multiple Paths Test 1.html | 3 +- .../SVG Import/Multiple Paths Test 2.html | 3 +- examples/SVG Import/Nested Groups Test.html | 3 +- examples/SVG Import/Rect Testing.html | 3 +- examples/SVG Import/Testing.html | 3 +- examples/SVG Import/Text Testing.html | 3 +- examples/SVG Import/Transform Testing.html | 3 +- src/svg/ExportSvg.js | 5 +- src/svg/ImportSvg.js | 8 +- test/tests/ExportSvg.js | 45 ++++------- test/tests/ImportSvg.js | 80 +++++++------------ 21 files changed, 71 insertions(+), 123 deletions(-) diff --git a/examples/SVG Export/Circle Testing.html b/examples/SVG Export/Circle Testing.html index 6618faa7..522c5b3a 100644 --- a/examples/SVG Export/Circle Testing.html +++ b/examples/SVG Export/Circle Testing.html @@ -28,8 +28,7 @@ var path = new Path.Circle(new Point(50, 50), 25); path.fillColor = 'red'; - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Empty Path Testing.html b/examples/SVG Export/Empty Path Testing.html index 53289f2a..2f522afa 100644 --- a/examples/SVG Export/Empty Path Testing.html +++ b/examples/SVG Export/Empty Path Testing.html @@ -22,9 +22,7 @@ var path2 = new Path(segments); path2.strokeColor = 'yellow'; - - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Line Testing.html b/examples/SVG Export/Line Testing.html index 71d46862..e19b4de9 100644 --- a/examples/SVG Export/Line Testing.html +++ b/examples/SVG Export/Line Testing.html @@ -37,8 +37,7 @@ line3.strokeColor = "yellow"; line3.strokeWidth = "5"; - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Random Path Testing.html b/examples/SVG Export/Random Path Testing.html index a22e4cc0..cdc94b5a 100644 --- a/examples/SVG Export/Random Path Testing.html +++ b/examples/SVG Export/Random Path Testing.html @@ -35,8 +35,7 @@ var path = new Path.Star(center, points, radius1, radius2); path.fillColor = 'black'; - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Rect and Attribute Testing.html b/examples/SVG Export/Rect and Attribute Testing.html index ab5a94c9..84d88bb4 100644 --- a/examples/SVG Export/Rect and Attribute Testing.html +++ b/examples/SVG Export/Rect and Attribute Testing.html @@ -49,8 +49,7 @@ path4.strokeColor= 'yellow'; path4.fillColor='purple'; - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Text Testing.html b/examples/SVG Export/Text Testing.html index 6922c692..6f004259 100644 --- a/examples/SVG Export/Text Testing.html +++ b/examples/SVG Export/Text Testing.html @@ -34,9 +34,8 @@ var c = new Path.Circle(p, 2); c.fillColor = colors[i]; } - - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + + var output = ExportSvg.exportProject(paper.project); var test = document.getElementById('svg') test.innerHTML = ""; test.appendChild (output); diff --git a/examples/SVG Export/Transform Test 1.html b/examples/SVG Export/Transform Test 1.html index 07b71c81..ded618fe 100644 --- a/examples/SVG Export/Transform Test 1.html +++ b/examples/SVG Export/Transform Test 1.html @@ -24,9 +24,8 @@ var clonedPath = circlePath.clone(); clonedPath.rotate(angle * i, circlePath.bounds.topLeft); }; - - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + + var output = ExportSvg.exportProject(paper.project); console.log(output); var test = document.getElementById('svg') test.innerHTML = ""; diff --git a/examples/SVG Export/Transform Test 2.html b/examples/SVG Export/Transform Test 2.html index 32d34bc8..be6f0bc1 100644 --- a/examples/SVG Export/Transform Test 2.html +++ b/examples/SVG Export/Transform Test 2.html @@ -21,8 +21,7 @@ copy.strokeColor = 'red'; copy.rotate(-45); copy.scale(0.5); - var esvg = new ExportSvg(); - var output = esvg.exportProject(paper.project); + var output = ExportSvg.exportProject(paper.project); var test = document.getElementById('svg') test.innerHTML = ""; test.appendChild (output); diff --git a/examples/SVG Import/Circle and Oval Testing.html b/examples/SVG Import/Circle and Oval Testing.html index 4523e0dd..315b6a02 100644 --- a/examples/SVG Import/Circle and Oval Testing.html +++ b/examples/SVG Import/Circle and Oval Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Line Testing.html b/examples/SVG Import/Line Testing.html index 9c594694..7d71ee67 100644 --- a/examples/SVG Import/Line Testing.html +++ b/examples/SVG Import/Line Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Multiple Paths Test 1.html b/examples/SVG Import/Multiple Paths Test 1.html index 9c5a1852..170366c7 100644 --- a/examples/SVG Import/Multiple Paths Test 1.html +++ b/examples/SVG Import/Multiple Paths Test 1.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Multiple Paths Test 2.html b/examples/SVG Import/Multiple Paths Test 2.html index f19fde4e..97cc5d51 100644 --- a/examples/SVG Import/Multiple Paths Test 2.html +++ b/examples/SVG Import/Multiple Paths Test 2.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Nested Groups Test.html b/examples/SVG Import/Nested Groups Test.html index 57d4268c..8354246e 100644 --- a/examples/SVG Import/Nested Groups Test.html +++ b/examples/SVG Import/Nested Groups Test.html @@ -12,8 +12,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Rect Testing.html b/examples/SVG Import/Rect Testing.html index 6d5d2dc1..d4537966 100644 --- a/examples/SVG Import/Rect Testing.html +++ b/examples/SVG Import/Rect Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Testing.html b/examples/SVG Import/Testing.html index e4a7607f..79c388f0 100644 --- a/examples/SVG Import/Testing.html +++ b/examples/SVG Import/Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Text Testing.html b/examples/SVG Import/Text Testing.html index 5a012294..985253ec 100644 --- a/examples/SVG Import/Text Testing.html +++ b/examples/SVG Import/Text Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/examples/SVG Import/Transform Testing.html b/examples/SVG Import/Transform Testing.html index 63e88164..5ef2f2a0 100644 --- a/examples/SVG Import/Transform Testing.html +++ b/examples/SVG Import/Transform Testing.html @@ -11,8 +11,7 @@ // strokeWidth: 2, // strokeCap: 'round' }; - var isvg = new ImportSvg(); - isvg.importSvg(document.getElementById('svg')); + ImportSvg.import(document.getElementById('svg')); diff --git a/src/svg/ExportSvg.js b/src/svg/ExportSvg.js index ca4d85f1..4e11b554 100644 --- a/src/svg/ExportSvg.js +++ b/src/svg/ExportSvg.js @@ -17,7 +17,6 @@ * @author Stetson-Team-Alpha */ - /** * @name ExportSvg * @@ -27,7 +26,7 @@ * */ -var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{ +var ExportSvg = this.ExportSvg = /** @Lends ExportSvg */{ create: function(tag) { return document.createElementNS('http://www.w3.org/2000/svg', tag); @@ -473,4 +472,4 @@ var ExportSvg = this.ExportSvg = Base.extend(/** @Lends ExportSvg# */{ } return type; } -}); +}; diff --git a/src/svg/ImportSvg.js b/src/svg/ImportSvg.js index 085881a9..f69201f6 100644 --- a/src/svg/ImportSvg.js +++ b/src/svg/ImportSvg.js @@ -28,7 +28,7 @@ * */ -var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{ +var ImportSvg = this.ImportSvg = /** @Lends ImportSvg */{ /** * Creates a Paper.js object using data parsed from the selected * SVG Document Object Model (DOM). The SVG object is imported, @@ -39,7 +39,7 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{ * @param {SVG DOM} svg An SVG DOM object with parameters * @return {item} A Paper.js layer */ - importSvg: function(svg) { + import: function(svg) { var item; var symbol; switch (svg.nodeName.toLowerCase()) { @@ -103,7 +103,7 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{ child = svg.childNodes[i]; if (child.nodeType != 1) continue; - item = this.importSvg(child); + item = this.import(child); if (item) group.addChild(item); } @@ -577,4 +577,4 @@ var ImportSvg = this.ImportSvg = Base.extend(/** @Lends ImportSvg# */{ } item.transform(matrix); } -}); +}; diff --git a/test/tests/ExportSvg.js b/test/tests/ExportSvg.js index d49d6215..0908edac 100644 --- a/test/tests/ExportSvg.js +++ b/test/tests/ExportSvg.js @@ -32,8 +32,7 @@ test('compare line path functions', function() { var line = new Path.Line([x1, y1], [x2, y2]); - var epjs = new ExportSvg(); - var exportedLine = epjs.exportPath(line); + var exportedLine = ExportSvg.exportPath(line); var shapex1 = shape.getAttribute('x1'); var shapey1 = shape.getAttribute('y1'); @@ -66,8 +65,7 @@ test('compare negative line path functions', function() { var line = new Path.Line([x1, y1], [x2, y2]); - var epjs = new ExportSvg(); - var exportedLine = epjs.exportPath(line); + var exportedLine = ExportSvg.exportPath(line); var shapex1 = shape.getAttribute('x1'); var shapey1 = shape.getAttribute('y1'); @@ -100,8 +98,7 @@ test('compare invalid line path functions', function() { var line = new Path.Line([x1, y1], [x2, y2]); - var epjs = new ExportSvg(); - var exportedLine = epjs.exportPath(line); + var exportedLine = ExportSvg.exportPath(line); var shapex1 = shape.getAttribute('x1'); var shapey1 = shape.getAttribute('y1'); @@ -136,8 +133,7 @@ test('compare invalid line path functions', function() { var size = new Size(100, 100); var path = new Path.Rectangle(point, size); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(path); + var exportedRectangle = ExportSvg.exportPath(path); var shapex1 = shape.getAttribute('x'); var shapey1 = shape.getAttribute('y1'); @@ -172,8 +168,7 @@ test('compare negative rectangle values', function() { var size = new Size(width, height); var rect = new Rectangle(topLeft, size); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(rect); + var exportedRectangle = ExportSvg.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -207,8 +202,7 @@ test('compare invalid rectangle values', function() { var size = new Size(width, height); var rect = new Rectangle(topLeft, size); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(rect); + var exportedRectangle = ExportSvg.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -248,8 +242,7 @@ test('compare rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(rect); + var exportedRectangle = ExportSvg.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -293,8 +286,7 @@ test('compare negative rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(rect); + var exportedRectangle = ExportSvg.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -338,8 +330,7 @@ test('compare invalid rounded rectangle values', function() { var rect = new Rectangle(topLeft, size); var roundRect = new Path.RoundRectangle(rect, cornerSize); - var epjs = new ExportSvg(); - var exportedRectangle = new epjs.exportPath(rect); + var exportedRectangle = ExportSvg.exportPath(rect); var shapex = shape.getAttribute('x'); var shapey = shape.getAttribute('y'); @@ -381,8 +372,7 @@ test('compare oval values', function() { var rect = new Rectangle(topLeft, bottomRight); var oval = new Path.Oval(rect); - var epjs = new ExportSvg(); - var exportedOval = epjs.exportPath(oval); + var exportedOval = ExportSvg.exportPath(oval); var shapecx = shape.getAttribute('cx'); var shapecy = shape.getAttribute('cy'); @@ -414,8 +404,7 @@ test('compare circle values', function() { var center = new Point(cx, cy); var circle = new Path.Circle(center, r); - var epjs = new ExportSvg(); - var exportedCircle = epjs.exportPath(circle); + var exportedCircle = ExportSvg.exportPath(circle); var shapecx = shape.getAttribute('cx'); var shapecy = shape.getAttribute('cy'); @@ -451,8 +440,7 @@ test('compare polygon values', function() { poly.closePath(); } - var epjs = new ExportSvg(); - var exportedPolygon = epjs.exportPath(poly); + var exportedPolygon = ExportSvg.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -482,8 +470,7 @@ test('compare negative polygon values', function() { poly.closePath(); } - var epjs = new ExportSvg(); - var exportedPolygon = epjs.exportPath(poly); + var exportedPolygon = ExportSvg.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -513,8 +500,7 @@ test('compare polyline values', function() { poly.closePath(); } - var epjs = new ExportSvg(); - var exportedPolygon = epjs.exportPath(poly); + var exportedPolygon = ExportSvg.exportPath(poly); var svgPoints = shape.getAttribute('points'); @@ -544,8 +530,7 @@ test('compare negative polyline values', function() { poly.closePath(); } - var epjs = new ExportSvg(); - var exportedPolygon = epjs.exportPath(poly); + var exportedPolygon = ExportSvg.exportPath(poly); var svgPoints = shape.getAttribute('points'); diff --git a/test/tests/ImportSvg.js b/test/tests/ImportSvg.js index 45d13460..e0b8c981 100644 --- a/test/tests/ImportSvg.js +++ b/test/tests/ImportSvg.js @@ -20,18 +20,17 @@ module('ImportSvg'); test('make an svg line', function() { var svgns = 'http://www.w3.org/2000/svg'; - var shape = document.createElementNS(svgns, 'line'); + var shape = document.createElementNS(svgns, 'line'); var x1 = 5, x2 = 45, y1 = 5, y2 = 45; - shape.setAttribute('x1', x1); - shape.setAttribute('y1', y1); - shape.setAttribute('x2', x2); - shape.setAttribute('y2', y2); + shape.setAttribute('x1', x1); + shape.setAttribute('y1', y1); + shape.setAttribute('x2', x2); + shape.setAttribute('y2', y2); - var isvg = new ImportSvg(); - var importedLine = isvg.importSvg(shape); + var importedLine = ImportSvg.import(shape); var line = new Path.Line([x1, y1], [x2, y2]); @@ -46,8 +45,7 @@ test('make an svg line with invalid values', function() { shape.setAttribute('x2', null); shape.setAttribute('y2', null); - var isvg = new ImportSvg(); - var importedLine = isvg.importSvg(shape); + var importedLine = ImportSvg.import(shape); var line = new Path.Line([0, 0], [0, 0]); @@ -67,8 +65,7 @@ test('compare rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); + var importedRectangle = ImportSvg.import(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -91,12 +88,11 @@ test('compare negative rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); - var topLeft = new Point(x, y); - var size = new Size(width, height); - var rectangle = new Rectangle(topLeft, size); - var realRectangle = new Path.Rectangle(rectangle); + var importedRectangle = ImportSvg.import(shape); + var topLeft = new Point(x, y); + var size = new Size(width, height); + var rectangle = new Rectangle(topLeft, size); + var realRectangle = new Path.Rectangle(rectangle); compareSegmentLists(importedRectangle.segments, realRectangle.segments, true); }); @@ -111,8 +107,7 @@ test('compare invalid rectangle values', function() { shape.setAttribute('width', null); shape.setAttribute('height', null); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); + var importedRectangle = ImportSvg.import(shape); var topLeft = new Point(0, 0); var size = new Size(0, 0); @@ -138,8 +133,7 @@ test('compare round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); + var importedRectangle = ImportSvg.import(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -166,8 +160,7 @@ test('compare negative round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); + var importedRectangle = ImportSvg.import(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -194,8 +187,7 @@ test('compare invalid round rectangle values', function() { shape.setAttribute('width', width); shape.setAttribute('height', height); - var isvg = new ImportSvg(); - var importedRectangle = isvg.importSvg(shape); + var importedRectangle = ImportSvg.import(shape); var topLeft = new Point(x, y); var size = new Size(width, height); @@ -218,8 +210,7 @@ test('compare oval values', function() { shape.setAttribute('rx', rx); shape.setAttribute('ry', ry); - var isvg = new ImportSvg(); - var importedOval = isvg.importSvg(shape); + var importedOval = ImportSvg.import(shape); var center = new Point(cx, cy); var offset = new Point(rx, ry); @@ -246,8 +237,7 @@ test('compare negative oval values', function() { shape.setAttribute('rx', rx); shape.setAttribute('ry', ry); - var isvg = new ImportSvg(); - var importedOval = isvg.importSvg(shape); + var importedOval = ImportSvg.import(shape); var center = new Point(cx, cy); var offset = new Point(rx, ry); @@ -269,8 +259,7 @@ test('compare invalid oval values', function() { shape.setAttribute('rx', null); shape.setAttribute('ry', null); - var isvg = new ImportSvg(); - var importedOval = isvg.importSvg(shape); + var importedOval = ImportSvg.import(shape); var center = new Point(0, 0); var offset = new Point(0, 0); @@ -294,8 +283,7 @@ test('compare circle values', function() { shape.setAttribute('cy', cy); shape.setAttribute('r', r); - var isvg = new ImportSvg(); - var importedCircle = isvg.importSvg(shape); + var importedCircle = ImportSvg.import(shape); var center = new Point(cx, cy); var circle = new Path.Circle(center, r); @@ -314,8 +302,7 @@ test('compare negative circle values', function() { shape.setAttribute('cy', cy); shape.setAttribute('r', r); - var isvg = new ImportSvg(); - var importedCircle = isvg.importSvg(shape); + var importedCircle = ImportSvg.import(shape); var center = new Point(cx, cy); var circle = new Path.Circle(center, r); @@ -332,8 +319,7 @@ test('compare invalid circle values', function() { shape.setAttribute('cy', null); shape.setAttribute('r', null); - var isvg = new ImportSvg(); - var importedCircle = isvg.importSvg(shape); + var importedCircle = ImportSvg.import(shape); var center = new Point(0, 0); var circle = new Path.Circle(center, 0); @@ -348,8 +334,7 @@ test('compare polygon values', function() { var svgpoints = "100,10 40,180 190,60 10,60 160,180"; shape.setAttribute('points', svgpoints); - var isvg = new ImportSvg(); - var importedPolygon = isvg.importSvg(shape); + var importedPolygon = ImportSvg.import(shape); var poly = new Path(); var points = shape.points; @@ -375,8 +360,7 @@ test('compare negative polygon values', function() { var svgpoints = "-100,-10 -40,-180 -190,-60 -10,-60 -160,-180"; shape.setAttribute('points', svgpoints); - var isvg = new ImportSvg(); - var importedPolygon = isvg.importSvg(shape); + var importedPolygon = ImportSvg.import(shape); var poly = new Path(); var points = shape.points; @@ -397,17 +381,16 @@ test('compare negative polygon values', function() { }); test('compare polyline values', function() { - var svgns = 'http://www.w3.org/2000/svg' + var svgns = 'http://www.w3.org/2000/svg'; var shape = document.createElementNS(svgns, 'polyline'); var svgpoints = "5,5 45,45 5,45 45,5"; shape.setAttribute('points', svgpoints); - var isvg = new ImportSvg(); - var importedPolyline = isvg.importSvg(shape); + var importedPolyline = ImportSvg.import(shape); var poly = new Path(); var points = shape.points; - var start = points.getItem(0) + var start = points.getItem(0); var point; poly.moveTo([start.x, start.y]); @@ -424,17 +407,16 @@ test('compare polyline values', function() { }); test('compare negative polyline values', function() { - var svgns = 'http://www.w3.org/2000/svg' + var svgns = 'http://www.w3.org/2000/svg'; var shape = document.createElementNS(svgns, 'polyline'); var svgpoints = "-5,-5 -45,-45 -5,-45 -45,-5"; shape.setAttribute('points', svgpoints); - var isvg = new ImportSvg(); - var importedPolyline = isvg.importSvg(shape); + var importedPolyline = ImportSvg.import(shape); var poly = new Path(); var points = shape.points; - var start = points.getItem(0) + var start = points.getItem(0); var point; poly.moveTo([start.x, start.y]);