0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-25 18:47:57 +01:00

Fix loading of sketches for wordart.

This commit is contained in:
Wouter R 2014-01-19 17:49:44 +01:00
parent 304657a104
commit e1206f73d4
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,13 @@ var wordFuncs = {
shapeLineTo(cx + 20, cy); shapeLineTo(cx + 20, cy);
shapeMoveTo(cx, cy - 20); shapeMoveTo(cx, cy - 20);
shapeLineTo(cx, cy + 20); shapeLineTo(cx, cy + 20);
},
"stats": function() {
var text = "Shape statistics:\nNumber of points: " + _points.length;
alert(text);
},
"pdump": function() {
console.log("points array: " + _points);
} }
}; };

View File

@ -67,7 +67,7 @@ function loadFromSvg(svgData) {
while (true) { while (true) {
skipSpace(); skipSpace();
var c = svgData.charAt(p); var c = svgData.charAt(p);
if (c == 'M' || c == 'm' || c == 'l') { //new command letter if (c == 'M' || c == 'm' || c == 'L' || c == 'l') { //new command letter
mode = c; mode = c;
} else if (c == '"') { //end of command chain } else if (c == '"') { //end of command chain
return true; return true;
@ -76,13 +76,13 @@ function loadFromSvg(svgData) {
numberEnd = svgData.indexOf(',', p); numberEnd = svgData.indexOf(',', p);
if (numberEnd == -1) { console.log("could not find comma in coordinate pair"); return false; } if (numberEnd == -1) { console.log("could not find comma in coordinate pair"); return false; }
len = numberEnd - p; len = numberEnd - p;
tx = parseInt(svgData.substr(p, len)); tx = parseFloat(svgData.substr(p, len));
p += len + 1; p += len + 1;
skipSpace(); skipSpace();
numberEnd = svgData.indexOf(' ', p); numberEnd = svgData.indexOf(' ', p);
if (numberEnd == -1) { console.log("could not find space after coordinate pair"); return false; } if (numberEnd == -1) { console.log("could not find space after coordinate pair"); return false; }
len = numberEnd - p; len = numberEnd - p;
ty = parseInt(svgData.substr(p, len)); ty = parseFloat(svgData.substr(p, len));
p += len; p += len;
if (mode == 'M' || mode == 'L') { if (mode == 'M' || mode == 'L') {