2017-01-13 13:47:14 +00:00
|
|
|
/* Sprite */
|
2017-01-19 22:00:37 +00:00
|
|
|
// modified SpriteMorph turtlestitch functions
|
2017-01-13 13:47:14 +00:00
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
SpriteMorph.prototype.origForward = SpriteMorph.prototype.forward;
|
2017-01-13 13:47:14 +00:00
|
|
|
SpriteMorph.prototype.forward = function (steps) {
|
2017-01-19 22:00:37 +00:00
|
|
|
oldx = this.xPosition();
|
|
|
|
oldy = this.yPosition();
|
|
|
|
this.origForward(steps);
|
|
|
|
if (!cmdCache.hasSteps())
|
|
|
|
cmdCache.initPosition(oldx, oldy);
|
|
|
|
cmdCache.addMoveTo(this.xPosition() , this.yPosition() , this.isDown);
|
|
|
|
this.reDrawTrails();
|
2017-01-13 13:47:14 +00:00
|
|
|
};
|
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
SpriteMorph.prototype.origGotoXY = SpriteMorph.prototype.gotoXY;
|
2017-01-13 13:47:14 +00:00
|
|
|
SpriteMorph.prototype.gotoXY = function (x, y, justMe) {
|
2017-01-19 22:00:37 +00:00
|
|
|
oldx = this.xPosition();
|
|
|
|
oldy = this.yPosition();
|
|
|
|
console.log("jump in place - don't add.");
|
|
|
|
this.origGotoXY(x, y, justMe);
|
|
|
|
if ( Math.abs(this.xPosition()-oldx)<=1 && Math.abs(this.yPosition()-oldy)<=1 ) {
|
|
|
|
console.log("jump in place - don't add.");
|
2017-01-13 13:47:14 +00:00
|
|
|
} else {
|
2017-01-19 22:00:37 +00:00
|
|
|
if (!cmdCache.hasSteps())
|
|
|
|
cmdCache.initPosition(oldx, oldy);
|
|
|
|
cmdCache.addMoveTo(this.xPosition() , this.yPosition() , this.isDown);
|
|
|
|
this.reDrawTrails();
|
2017-01-13 13:47:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
SpriteMorph.prototype.origClear = SpriteMorph.prototype.clear;
|
|
|
|
SpriteMorph.prototype.clear = function () {
|
|
|
|
this.origClear();
|
|
|
|
cmdCache.clear();
|
|
|
|
this.reDrawTrails();
|
2017-01-13 13:47:14 +00:00
|
|
|
};
|
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
SpriteMorph.prototype.reDrawTrails = function () {
|
2017-01-13 13:47:14 +00:00
|
|
|
this.parent.clearPenTrails();
|
2017-01-19 22:00:37 +00:00
|
|
|
reDraw(this.parent.penTrails());
|
2017-01-13 13:47:14 +00:00
|
|
|
};
|
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
/* Stage */
|
|
|
|
// modified StageMorph turtlestitch functions
|
2017-01-13 13:47:14 +00:00
|
|
|
|
2017-01-19 22:00:37 +00:00
|
|
|
StageMorph.prototype.referencePos = null;
|
|
|
|
StageMorph.prototype.mouseScroll = function (y, x) {
|
|
|
|
if (y > 0) {
|
|
|
|
cmdCache.zoomOut();
|
|
|
|
} else if (y < 0) {
|
|
|
|
cmdCache.zoomIn();
|
2017-01-13 13:47:14 +00:00
|
|
|
}
|
2017-01-19 22:00:37 +00:00
|
|
|
|
|
|
|
this.clearPenTrails();
|
|
|
|
reDraw(this.penTrails());
|
2017-01-13 13:47:14 +00:00
|
|
|
};
|