kopia lustrzana https://github.com/backface/turtlestitch
show also first stitchpoint after jumps
rodzic
8c14ae96e3
commit
c2587d0230
|
@ -2378,7 +2378,7 @@ SpriteMorph.prototype.freshPalette = function (category) {
|
||||||
palette.growth = new Point(0, MorphicPreferences.scrollBarSize);
|
palette.growth = new Point(0, MorphicPreferences.scrollBarSize);
|
||||||
|
|
||||||
// toolbar:
|
// toolbar:
|
||||||
|
|
||||||
palette.toolBar = new AlignmentMorph('column');
|
palette.toolBar = new AlignmentMorph('column');
|
||||||
|
|
||||||
searchButton = new PushButtonMorph(
|
searchButton = new PushButtonMorph(
|
||||||
|
|
|
@ -19,6 +19,8 @@ SpriteMorph.prototype.categories =
|
||||||
SpriteMorph.prototype.blockColor = {
|
SpriteMorph.prototype.blockColor = {
|
||||||
motion : new Color(74, 108, 212),
|
motion : new Color(74, 108, 212),
|
||||||
pen : new Color(0, 161, 120),
|
pen : new Color(0, 161, 120),
|
||||||
|
looks : new Color(143, 86, 227),
|
||||||
|
sound : new Color(207, 74, 217),
|
||||||
embroidery : new Color(0,120,0),
|
embroidery : new Color(0,120,0),
|
||||||
control : new Color(230, 168, 34),
|
control : new Color(230, 168, 34),
|
||||||
sensing : new Color(4, 148, 220),
|
sensing : new Color(4, 148, 220),
|
||||||
|
@ -177,7 +179,6 @@ SpriteMorph.prototype.addStitch = function(x1, y1, x2, y2, angle=false ) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
this.reRender();
|
this.reRender();
|
||||||
this.lastJumped = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,7 +234,6 @@ SpriteMorph.prototype.addJumpLine = function(x1, y1, x2, y2) {
|
||||||
stage.myJumpLines.add(mesh);
|
stage.myJumpLines.add(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastJumped = true;
|
|
||||||
this.reRender();
|
this.reRender();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ SpriteMorph.prototype.zigzagForwardEnd = function (steps, width=10) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.ZForward = function (steps, width=10) {
|
SpriteMorph.prototype.ZForward = function (steps, width=10) {
|
||||||
var c = Math.sqrt(steps/2*steps/2 + width * width);
|
var c = Math.sqrt(steps*steps + width * width);
|
||||||
var alpha = degrees(Math.asin(width/c));
|
var alpha = degrees(Math.asin(width/c));
|
||||||
|
|
||||||
this.turn(90);
|
this.turn(90);
|
||||||
|
@ -574,7 +574,7 @@ SpriteMorph.prototype.ZForward = function (steps, width=10) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.ZForwardStart = function (steps, width=10) {
|
SpriteMorph.prototype.ZForwardStart = function (steps, width=10) {
|
||||||
var c = Math.sqrt(steps/2*steps/2 + width * width);
|
var c = Math.sqrt(steps*steps + width * width);
|
||||||
var alpha = degrees(Math.asin(width/c));
|
var alpha = degrees(Math.asin(width/c));
|
||||||
|
|
||||||
this.turn(90);
|
this.turn(90);
|
||||||
|
@ -585,7 +585,7 @@ SpriteMorph.prototype.ZForwardStart = function (steps, width=10) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.ZForwardEnd = function (steps, width=10) {
|
SpriteMorph.prototype.ZForwardEnd = function (steps, width=10) {
|
||||||
var c = Math.sqrt(steps/2*steps/2 + width * width);
|
var c = Math.sqrt(steps*steps + width * width);
|
||||||
var alpha = degrees(Math.asin(width/c));
|
var alpha = degrees(Math.asin(width/c));
|
||||||
|
|
||||||
this.turn(90);
|
this.turn(90);
|
||||||
|
@ -625,6 +625,8 @@ SpriteMorph.prototype.doMoveForward = function (steps) {
|
||||||
|
|
||||||
if (dist != 0) {
|
if (dist != 0) {
|
||||||
this.setPosition(dest);
|
this.setPosition(dest);
|
||||||
|
|
||||||
|
var isFirst = this.parentThatIsA(StageMorph).turtleShepherd.isEmpty();
|
||||||
warn = stage.turtleShepherd.moveTo(
|
warn = stage.turtleShepherd.moveTo(
|
||||||
oldx, oldy,
|
oldx, oldy,
|
||||||
this.xPosition(), this.yPosition(),
|
this.xPosition(), this.yPosition(),
|
||||||
|
@ -636,12 +638,13 @@ SpriteMorph.prototype.doMoveForward = function (steps) {
|
||||||
if (warn) {
|
if (warn) {
|
||||||
this.addDensityPoint(this.xPosition(), this.yPosition());
|
this.addDensityPoint(this.xPosition(), this.yPosition());
|
||||||
}
|
}
|
||||||
|
if (isFirst || this.lastJumped ) {
|
||||||
if (this.parentThatIsA(StageMorph).turtleShepherd.isEmpty()) {
|
this.addStitchPoint(oldx,oldy);
|
||||||
this.addStitchPoint(0,0);
|
|
||||||
}
|
}
|
||||||
|
this.lastJumped = false;
|
||||||
} else {
|
} else {
|
||||||
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
|
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
|
||||||
|
this.lastJumped = true;
|
||||||
}
|
}
|
||||||
stage.moveTurtle(this.xPosition(), this.yPosition());
|
stage.moveTurtle(this.xPosition(), this.yPosition());
|
||||||
}
|
}
|
||||||
|
@ -732,10 +735,13 @@ SpriteMorph.prototype.gotoXY = function (x, y, justMe, noShadow) {
|
||||||
if (warn) {
|
if (warn) {
|
||||||
this.addDensityPoint(this.xPosition(), this.yPosition());
|
this.addDensityPoint(this.xPosition(), this.yPosition());
|
||||||
}
|
}
|
||||||
if (this.parentThatIsA(StageMorph).turtleShepherd.isEmpty())
|
|
||||||
this.addStitchPoint(0,0);
|
if (this.parentThatIsA(StageMorph).turtleShepherd.isEmpty() || this.lastJumped)
|
||||||
|
this.addStitchPoint(oldx, oldy);
|
||||||
|
this.lastJumped = false;
|
||||||
} else {
|
} else {
|
||||||
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
|
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
|
||||||
|
this.lastJumped = true;
|
||||||
}
|
}
|
||||||
stage.moveTurtle(this.xPosition(), this.yPosition());
|
stage.moveTurtle(this.xPosition(), this.yPosition());
|
||||||
}
|
}
|
||||||
|
@ -2025,9 +2031,9 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'running by %n steps',
|
spec: 'running stitch by %n steps',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
defaults: [12]
|
defaults: [10]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blocks.beanStitch =
|
this.blocks.beanStitch =
|
||||||
|
@ -2036,16 +2042,16 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'bean stitch by %n',
|
spec: 'bean stitch by %n',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
defaults: [12]
|
defaults: [10]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blocks.crossStitch =
|
this.blocks.crossStitch =
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'cross stitch by in %n width %n center %b',
|
spec: 'cross stitch in %n by %n center %b',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
defaults: [12 , 12, true]
|
defaults: [10, 10, true]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blocks.zigzagStitch =
|
this.blocks.zigzagStitch =
|
||||||
|
@ -2061,7 +2067,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'Z-Stitch with density %n width %n center %b',
|
spec: 'Z-stitch with density %n width %n center %b',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
defaults: [20, 10, true]
|
defaults: [20, 10, true]
|
||||||
};
|
};
|
||||||
|
@ -2345,6 +2351,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push(block('ZStitch'));
|
blocks.push(block('ZStitch'));
|
||||||
blocks.push(block('satinStitch'));
|
blocks.push(block('satinStitch'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
|
blocks.push('-');
|
||||||
blocks.push(block('jumpStitch'));
|
blocks.push(block('jumpStitch'));
|
||||||
blocks.push(block('tieStitch'));
|
blocks.push(block('tieStitch'));
|
||||||
blocks.push(block('trimStitch'));
|
blocks.push(block('trimStitch'));
|
||||||
|
|
Ładowanie…
Reference in New Issue