Skip to content

Commit 609ad57

Browse files
committed
Bugfix for shorthand curves
1 parent b75772e commit 609ad57

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

main.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function setStart(e) {
8282
var svgText = document.getElementById("pathText").value;
8383
var pathData = new SVGPathData(svgText);
8484

85-
console.log(JSON.parse(JSON.stringify(pathData.commands)));
85+
pathData.normalizeST();
8686

8787
// 1. Recalculate m/M
8888
var startx = 0;
@@ -104,8 +104,6 @@ function setStart(e) {
104104
pathData.commands[0].x = startx;
105105
pathData.commands[0].y = starty;
106106

107-
console.log(JSON.parse(JSON.stringify(pathData.commands)));
108-
109107
// 2. If we end with a z/Z, change to an L
110108
// Otherwise, create an L back home or things will break
111109
if(pathData.commands[pathData.commands.length-1].type == SVGPathData.CLOSE_PATH) {
@@ -117,8 +115,6 @@ function setStart(e) {
117115
pathData.commands.push({type: SVGPathData.LINE_TO, relative: false, x: origx, y: origy});
118116
}
119117

120-
console.log(JSON.parse(JSON.stringify(pathData.commands)));
121-
122118
// 3. Reorder commands: Keep index 0, but move next n to end
123119

124120
const mComm = pathData.commands.shift();
@@ -127,8 +123,6 @@ function setStart(e) {
127123
}
128124
pathData.commands.unshift(mComm);
129125

130-
console.log(JSON.parse(JSON.stringify(pathData.commands)));
131-
132126
// Put data back
133127
document.getElementById("pathText").value = pathData.sanitize().encode();
134128
renderSVG();

0 commit comments

Comments
 (0)