From 09adb5f484bcc7067cab958ae944197f9990c8f5 Mon Sep 17 00:00:00 2001 From: Michael Aschauer Date: Wed, 8 Nov 2017 11:45:52 +0100 Subject: [PATCH] fix: add density warning mark to goto also --- stitchcode/objects.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/stitchcode/objects.js b/stitchcode/objects.js index 3242bd93..564203ca 100644 --- a/stitchcode/objects.js +++ b/stitchcode/objects.js @@ -145,6 +145,7 @@ SpriteMorph.prototype.forward = function (steps) { var dest, dist = steps * this.parent.scale || 0; stage = this.parentThatIsA(StageMorph); + warn = false; oldx = this.xPosition(); oldy = this.yPosition(); @@ -163,6 +164,7 @@ SpriteMorph.prototype.forward = function (steps) { oldx, oldy, this.xPosition(), this.yPosition(), this.isDown ); + if (warn) { this.addDensityPoint(this.xPosition(), this.yPosition()); } @@ -200,6 +202,7 @@ SpriteMorph.prototype.forwardBy = function (totalsteps, stepsize) { SpriteMorph.prototype.origGotoXY = SpriteMorph.prototype.gotoXY; SpriteMorph.prototype.gotoXY = function (x, y, justMe) { var stage = this.parentThatIsA(StageMorph); + warn = false; oldx = this.xPosition(); oldy = this.yPosition(); this.origGotoXY(x, y, justMe); @@ -207,14 +210,17 @@ SpriteMorph.prototype.gotoXY = function (x, y, justMe) { // jump in place - don't add / ignore console.log("jump in place - don't add / ignore"); } else { - this.parentThatIsA(StageMorph).turtleShepherd.moveTo( + warn = this.parentThatIsA(StageMorph).turtleShepherd.moveTo( oldx, oldy, this.xPosition(), this.yPosition(), this.isDown ); - if (this.isDown) + if (this.isDown) { this.addStitch(oldx, oldy, this.xPosition(), this.yPosition()); - else { + if (warn) { + this.addDensityPoint(this.xPosition(), this.yPosition()); + } + } else { this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition()); } this.addStitchPoint(oldx, oldy, this.xPosition(), this.yPosition());