Skip to content

Commit 57c09ac

Browse files
committed
Fixed output of positions json file.
1 parent 0918c8d commit 57c09ac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/fileWrite.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,14 @@ function makePositionsString(nodeList){
135135
//Scale the coordinates
136136
var relX = nodeList[i].xPos / map.width,
137137
relY = nodeList[i].yPos / map.height;
138-
139-
posJSON = posJSON + '[' + relX.toString() + ', ' + relY.toString() + '], ';
138+
139+
//Make sure the last entry doesn't have a comma
140+
if(i < nodeList.length - 1){
141+
posJSON = posJSON + '[' + relX.toString() + ', ' + relY.toString() + '], ';
142+
}
143+
else{
144+
posJSON = posJSON + '[' + relX.toString() + ', ' + relY.toString() + ']';
145+
}
140146
}
141147

142148
//Add the last bracket

0 commit comments

Comments
 (0)