Fix small SVG path-data parser issue.

This commit is contained in:
Jürg Lehni 2013-02-28 19:33:08 -08:00
parent 82cefa9846
commit 5fbc6e939d
2 changed files with 2 additions and 3 deletions

View file

@ -8,7 +8,6 @@
var start = Date.now();
project.importSvg(document.getElementById('svg'));
console.log(Date.now() - start);
console.log(project.exportJson({ precision: 2 }));
</script>
</head>
<body>

View file

@ -78,12 +78,12 @@ var PathItem = this.PathItem = Item.extend(/** @lends PathItem# */{
}
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i].trim();
var part = parts[i];
cmd = part[0],
lower = cmd.toLowerCase();
// Split at white-space, commas but also before signs.
// Use positive lookahead to include signs.
coords = part.slice(1).split(/[\s,]+|(?=[+-])/);
coords = part.slice(1).trim().split(/[\s,]+|(?=[+-])/);
relative = cmd === lower;
switch (lower) {
case 'm':