From 05bf52b6af64bbd5085217fc69586edfc20f307c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 5 Nov 2012 18:27:13 -0800 Subject: [PATCH] Minor tweaks in SvgImporter code. --- src/svg/SvgImporter.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/svg/SvgImporter.js b/src/svg/SvgImporter.js index e4b04863..4d85be67 100644 --- a/src/svg/SvgImporter.js +++ b/src/svg/SvgImporter.js @@ -61,14 +61,14 @@ var SvgImporter = this.SvgImporter = new function() { return group; } - function importPoly(svg) { + function importPoly(svg, type) { var path = new Path(), points = svg.points, start = points.getItem(0); path.moveTo(start); for (var i = 1, l = points.numberOfItems; i < l; i++) path.lineTo(points.getItem(i)); - if (svg.nodeName.toLowerCase() == 'polygon') + if (type === 'polygon') path.closePath(); return path; } @@ -406,9 +406,10 @@ var SvgImporter = this.SvgImporter = new function() { * @return {Item} the converted Paper.js item */ importSvg: function(svg) { - var importer = importers[svg.nodeName.toLowerCase()]; + var type = svg.nodeName.toLowerCase(), + importer = importers[type]; // TODO: importer == null: Not supported yet. - var item = importer && importer(svg); + var item = importer && importer(svg, type); if (item) applyAttributesAndStyles(svg, item); return item;