From 93372da384d3b0617aa36968e61110f0ace4e13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 2 Nov 2012 22:57:06 -0700 Subject: [PATCH] Further shorten code. --- src/svg/SvgImporter.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/svg/SvgImporter.js b/src/svg/SvgImporter.js index fc3cac32..b1559ee7 100644 --- a/src/svg/SvgImporter.js +++ b/src/svg/SvgImporter.js @@ -121,8 +121,7 @@ var SvgImporter = this.SvgImporter = new function() { path: function(svg) { var path = new Path(), list = svg.pathSegList, - segments = path.getSegments(), - relative; + segments = path.getSegments(); for (var i = 0, l = list.numberOfItems; i < l; i++) { // To shrink code, we replaced the long SVGPathSeg constants // with their actual numeric values. The comments keep reference @@ -131,11 +130,9 @@ var SvgImporter = this.SvgImporter = new function() { var segment = list.getItem(i); if (segment.pathSegType === 0) // SVGPathSeg.PATHSEG_UNKNOWN continue; - if (segment.pathSegType % 2 == 1 && segments.length > 0) { - relative = path.getLastSegment().getPoint(); - } else { - relative = Point.create(0, 0); - } + var relative = segment.pathSegType % 2 == 1 && segments.length + ? path.getLastSegment().getPoint() + : Point.create(0, 0); var point = Point.create(segment.x, segment.y).add(relative); switch (segment.pathSegType) { case 1: // SVGPathSeg.PATHSEG_CLOSEPATH: