fix jump stitch encoding (needs testing)

pull/68/head
Michael Aschauer 2018-10-17 20:02:53 +02:00
rodzic 724b6ea633
commit a2926a51b7
2 zmienionych plików z 15 dodań i 14 usunięć

Wyświetl plik

@ -1093,12 +1093,11 @@ IDE_Morph.prototype.setProjectName = function (string) {
if (string.replace(/['"]/g, '') != this.projectName || SnapCloud.username != this.creator) {
this.remixHistory = this.creator + ":" + this.projectName + ";" + this.remixHistory
}
this.origCreator = SnapCloud.username != this.creator ? this.creator : SnapCloud.username;
this.creator = SnapCloud.username ? SnapCloud.username : "anonymous";
if (string.replace(/['"]/g, '') != this.projectName) {
this.origName = this.projectName;
}
this.origName = this.projectName;
this.origCreator = SnapCloud.username != this.creator ? this.creator : SnapCloud.username;
this.creator = SnapCloud.username ? SnapCloud.username : "anonymous";
this.projectName = string.replace(/['"]/g, ''); // filter quotation marks
this.hasChangedMedia = true;
this.controlBar.updateLabel();

Wyświetl plik

@ -396,11 +396,14 @@ TurtleShepherd.prototype.toEXP = function() {
dmax = Math.max(Math.abs(x1 - x0), Math.abs(y1 - y0));
dsteps = Math.abs(dmax / 127);
if (!lastStitch.penDown)
move(0,0);
if (dsteps <= 1) {
if (!stitch.penDown) {
//ignore color
//expArr.push(0x80);
//expArr.push(0x04);
expArr.push(0x80);
expArr.push(0x04);
}
move(Math.round(x1 - x0), Math.round(y1 - y0));
} else {
@ -414,13 +417,13 @@ TurtleShepherd.prototype.toEXP = function() {
sum_x += (x1 - x0)/dsteps;
sum_y += (y1 - y0)/dsteps;
} else {
move(Math.round((x1 - x0) - sum_x),
Math.round((y1 - y0) - sum_y));
move(Math.round((x1 - x0) - sum_x), Math.round((y1 - y0) - sum_y));
}
}
}
}
} else {
move(Math.round(Math.round(stitch.x * scale), -Math.round(stitch.y * scale)));
}
lastStitch = stitch;
hasFirst = true;
}
@ -625,16 +628,15 @@ TurtleShepherd.prototype.toDST = function() {
dmax = Math.max(Math.abs(x1 - x0), Math.abs(y1 - y0));
dsteps = Math.abs(dmax / 121);
if (!lastStitch.penDown)
encodeTajimaStitch(0,0,false);
if (dsteps <= 1) {
encodeTajimaStitch((x1 - x0), (y1 - y0),
!stitch.penDown);
count_stitches++;
} else {
for(j=0;j<dsteps;j++) {
//if (tStitch.stitches.jump[i]) {
// expArr.push(0x80);
// expArr.push(0x04);
//}
if (j < dsteps -1) {
encodeTajimaStitch(
Math.round((x1 - x0)/dsteps),