diff --git a/stitchcode/objects.js b/stitchcode/objects.js index b19b6965..4ee230b1 100644 --- a/stitchcode/objects.js +++ b/stitchcode/objects.js @@ -1303,8 +1303,6 @@ SpriteMorph.prototype.wait = function(millis) //SpriteMorph.prototype.thumbnail = function (extentPoint) {}; //SpriteMorph.prototype.drawNew = function () { this.hide() } - - // THREE additions THREE.Object3D.prototype.addLineToPointWithColor = function (point, color, thickness) { @@ -1321,24 +1319,24 @@ THREE.Object3D.prototype.addLineFromPointToPointWithColor = function (originPoin return line; }; - SpriteMorph.prototype.resetAll = function () { - var myself = this; - myself.stitchtype = 0; + var myself = this; + myself.stitchtype = 0; myself.stitchoptions = {}; - myself.isRunning = false; - myself.setColor(StageMorph.prototype.defaultPenColor); + myself.isRunning = false; + myself.setColor(StageMorph.prototype.defaultPenColor); + myself.parentThatIsA(StageMorph).setPenSize(1); myself.gotoXY(0,0); myself.setHeading(90); - myself.clear(); + myself.clear(); myself.isDown = true; } SpriteMorph.prototype.resetStitchSettings = function () { - var myself = this; + var myself = this; myself.stitchoptions = {} myself.stitchtype = 0; - myself.isRunning = false; + myself.isRunning = false; } // Block specs diff --git a/stitchcode/turtleShepherd.js b/stitchcode/turtleShepherd.js index c338fe51..a5280317 100644 --- a/stitchcode/turtleShepherd.js +++ b/stitchcode/turtleShepherd.js @@ -49,8 +49,8 @@ TurtleShepherd.prototype.clear = function() { this.densityWarning = false; this.colors = []; this.newColor = 0; - this.oldColor = 0; - this.penSize = 1; + this.oldColor = this.defaultColor; + this.penSize = 1; this.newPenSize = 0; }; @@ -165,11 +165,11 @@ TurtleShepherd.prototype.moveTo= function(x1, y1, x2, y2, penState) { if (this.colors.length < 1) { if (this.newColor) { this.colors.push(this.newColor); - this.newColor = false; + //this.newColor = false; } else { this.colors.push(this.defaultColor); } - this.oldColor = this.colors[this.colors.length-1]; + //this.oldColor = this.colors[this.colors.length-1]; } } @@ -359,16 +359,20 @@ TurtleShepherd.prototype.toSVG = function() { penSize = 1; lastStitch = null; color = this.defaultColor; + + //console.log("export svg"); + //console.log(this.colors); + //console.log(this.cache); for (var i=0; i < this.cache.length; i++) { if (this.cache[i].cmd == "color" && !this.ignoreColors) { color = this.cache[i].color; - colorChanged = true; + if (hasFirst) colorChanged = true; if (tagOpen) svgStr += '" />\n'; tagOpen = false; } else if (this.cache[i].cmd == "pensize") { penSize = this.cache[i].pensize; - penSizeChanged = true; + if (hasFirst) penSizeChanged = true; if (tagOpen) svgStr += '" />\n'; tagOpen = false; } else if (this.cache[i].cmd == "move") {