diff --git a/js/Keyboard.js b/js/Keyboard.js index c0ff16e..825e514 100644 --- a/js/Keyboard.js +++ b/js/Keyboard.js @@ -17,6 +17,13 @@ var wordFuncs = { shapeLineTo(cx + 20, cy); shapeMoveTo(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); } }; diff --git a/js/Svg.js b/js/Svg.js index d61ce96..b93c90f 100644 --- a/js/Svg.js +++ b/js/Svg.js @@ -67,7 +67,7 @@ function loadFromSvg(svgData) { while (true) { skipSpace(); 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; } else if (c == '"') { //end of command chain return true; @@ -76,13 +76,13 @@ function loadFromSvg(svgData) { numberEnd = svgData.indexOf(',', p); if (numberEnd == -1) { console.log("could not find comma in coordinate pair"); return false; } len = numberEnd - p; - tx = parseInt(svgData.substr(p, len)); + tx = parseFloat(svgData.substr(p, len)); p += len + 1; skipSpace(); numberEnd = svgData.indexOf(' ', p); if (numberEnd == -1) { console.log("could not find space after coordinate pair"); return false; } len = numberEnd - p; - ty = parseInt(svgData.substr(p, len)); + ty = parseFloat(svgData.substr(p, len)); p += len; if (mode == 'M' || mode == 'L') {