kopia lustrzana https://github.com/backface/turtlestitch
renaming
rodzic
50454456db
commit
ae3f4a4bed
|
@ -1524,7 +1524,7 @@ IDE_Morph.prototype.createCategories = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.categories.forEach(function (cat) {
|
SpriteMorph.prototype.categories.forEach(function (cat) {
|
||||||
if (!contains(['sound','looks'], cat)) {
|
if (!contains(['sound','looks','lists'], cat)) {
|
||||||
addCategoryButton(cat);
|
addCategoryButton(cat);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -99,22 +99,22 @@ tempDict = {
|
||||||
'hexadezimaler Farbwert',
|
'hexadezimaler Farbwert',
|
||||||
'HSV color':
|
'HSV color':
|
||||||
'HSV Farbe',
|
'HSV Farbe',
|
||||||
'set pen color to':
|
'set color to %clr':
|
||||||
'setze Stiftfarbe auf',
|
'setze Farbe auf %clr',
|
||||||
'set pen color to RGB %n %n %n':
|
'set color to RGB %n %n %n':
|
||||||
'setze Stiftfarbe auf RGB %n %n %n',
|
'setze Farbe auf RGB %n %n %n',
|
||||||
'set pen color to HSV %n %n %n':
|
'set color to HSV %n %n %n':
|
||||||
'setze Stiftfarbe auf HSV %n %n %n',
|
'setze Farbe auf HSV %n %n %n',
|
||||||
'set pen color to hex %s':
|
'set color to hex %s':
|
||||||
'setze Stiftfarbe auf hex %s',
|
'setze Farbe auf hex %s',
|
||||||
'set pen color by hue %huewheel':
|
'set color by hue %huewheel':
|
||||||
'setze Stiftfarbton %huewheel',
|
'setze Farbton %huewheel',
|
||||||
'set pen %hsb to %n':
|
'set %hsb to %n':
|
||||||
'setze %hsb auf %n',
|
'setze %hsb auf %n',
|
||||||
'change pen %hsb by %n':
|
'change %hsb by %n':
|
||||||
'\u00e4ndere %hsb auf %n',
|
'\u00e4ndere %hsb auf %n',
|
||||||
'pen color: %hsb':
|
'color: %hsb':
|
||||||
'Siftfarbe: %hsb',
|
'Farbe: %hsb',
|
||||||
'opacity':
|
'opacity':
|
||||||
'Deckkraft',
|
'Deckkraft',
|
||||||
'set opacity to %n':
|
'set opacity to %n':
|
||||||
|
@ -128,6 +128,13 @@ tempDict = {
|
||||||
'change hue by %n':
|
'change hue by %n':
|
||||||
'\u00e4ndere Farbton um %n',
|
'\u00e4ndere Farbton um %n',
|
||||||
|
|
||||||
|
'Embroidery':
|
||||||
|
'Stickerei',
|
||||||
|
'jump stitch %b':
|
||||||
|
'Sprungstich %b',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'draw text: %s scale: %n font: %n':
|
'draw text: %s scale: %n font: %n':
|
||||||
'Schreibe %s Skalierung: %n Schrift %n',
|
'Schreibe %s Skalierung: %n Schrift %n',
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,7 @@ SpriteMorph.prototype.categories =
|
||||||
'pen',
|
'pen',
|
||||||
'variables',
|
'variables',
|
||||||
'embroidery',
|
'embroidery',
|
||||||
|
'lists',
|
||||||
'colors',
|
'colors',
|
||||||
'other',
|
'other',
|
||||||
];
|
];
|
||||||
|
@ -305,20 +306,18 @@ SpriteMorph.prototype.clearStitchSettings = function () {
|
||||||
this.isDown = true;
|
this.isDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.runningStitch = function (length) {
|
SpriteMorph.prototype.runningStitch = function (length, autoadjust) {
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
this.stitchtype = "running";
|
this.stitchtype = "running";
|
||||||
this.stitchoptions = { length: length, mode: "auto-adjust" }
|
this.stitchoptions = { length: length, autoadjust: autoadjust }
|
||||||
console.log("set running stitch");
|
|
||||||
} else {
|
} else {
|
||||||
this.stitchtype = 0;
|
this.stitchtype = 0;
|
||||||
this.stitchoptions = {};
|
this.stitchoptions = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteMorph.prototype.jumpStitch = function () {
|
SpriteMorph.prototype.jumpStitch = function (on = true) {
|
||||||
this.stitchtype = "jump";
|
this.isDown = !on;
|
||||||
this.isDown = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -339,8 +338,8 @@ SpriteMorph.prototype.forward = function (steps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dist != 0) {
|
if (dist != 0) {
|
||||||
if ( this.stitchtype == "running" && dist > this.stitchoptions.length) {
|
if ( this.stitchtype == "running" && dist > this.stitchoptions.length && this.isDown) {
|
||||||
if (this.stitchoptions.mode == "auto-adjust") {
|
if (this.stitchoptions.autoadjust) {
|
||||||
var real_length = dist / Math.round(dist / this.stitchoptions.length);
|
var real_length = dist / Math.round(dist / this.stitchoptions.length);
|
||||||
this.forwardBy(steps, real_length);
|
this.forwardBy(steps, real_length);
|
||||||
} else {
|
} else {
|
||||||
|
@ -436,11 +435,9 @@ SpriteMorph.prototype.gotoXY = function (x, y, justMe, noShadow) {
|
||||||
//console.log("jump in place - don't add / ignore", this.isDown,this.xPosition(), this.yPosition(), dist);
|
//console.log("jump in place - don't add / ignore", this.isDown,this.xPosition(), this.yPosition(), dist);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( this.stitchtype == "running" && dist > this.stitchoptions.length) {
|
if ( this.stitchtype == "running" && dist > this.stitchoptions.length && this.isDown) {
|
||||||
console.log("is running stitch");
|
if (this.stitchoptions.autoadjust) {
|
||||||
if (this.stitchoptions.mode == "auto-adjust") {
|
|
||||||
var real_length = dist / Math.round(dist / this.stitchoptions.length);
|
var real_length = dist / Math.round(dist / this.stitchoptions.length);
|
||||||
console.log(dist, this.stitchoptions.length, Math.round(dist / this.stitchoptions.length), real_length);
|
|
||||||
stepsize = real_length;
|
stepsize = real_length;
|
||||||
} else {
|
} else {
|
||||||
stepsize = this.stitchoptions.length;
|
stepsize = this.stitchoptions.length;
|
||||||
|
@ -1641,7 +1638,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
spec: 'set pen color to %clr'
|
spec: 'set color to %clr'
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blocks.setColorRGB =
|
this.blocks.setColorRGB =
|
||||||
|
@ -1649,7 +1646,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
spec: 'set pen color to RGB %n %n %n',
|
spec: 'set color to RGB %n %n %n',
|
||||||
defaults: [0, 255, 0]
|
defaults: [0, 255, 0]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1658,7 +1655,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
spec: 'set pen color to hex %s',
|
spec: 'set color to hex %s',
|
||||||
defaults: ['#ff0000']
|
defaults: ['#ff0000']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1667,7 +1664,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
spec: 'set pen color to HSV %n %n %n',
|
spec: 'set color to HSV %n %n %n',
|
||||||
defaults: [0.3, 0.7, 0.6]
|
defaults: [0.3, 0.7, 0.6]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1675,7 +1672,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'pen',
|
||||||
spec: 'set opacity to %n',
|
spec: 'set opacity to %n',
|
||||||
defaults: [100]
|
defaults: [100]
|
||||||
};
|
};
|
||||||
|
@ -1684,7 +1681,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
category: 'colors',
|
category: 'pen',
|
||||||
spec: 'change opacity by %n',
|
spec: 'change opacity by %n',
|
||||||
defaults: [10]
|
defaults: [10]
|
||||||
};
|
};
|
||||||
|
@ -1693,7 +1690,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'reporter',
|
type: 'reporter',
|
||||||
category: 'colors',
|
category: 'pen',
|
||||||
spec: 'opacity',
|
spec: 'opacity',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1726,14 +1723,14 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'set pen color by hue %huewheel',
|
spec: 'set color by hue %huewheel',
|
||||||
category: 'colors'
|
category: 'colors'
|
||||||
};
|
};
|
||||||
this.blocks.setHSB =
|
this.blocks.setHSB =
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'set pen %hsb to %n',
|
spec: 'set %hsb to %n',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
defaults: ['hue', 50]
|
defaults: ['hue', 50]
|
||||||
};
|
};
|
||||||
|
@ -1741,7 +1738,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'change pen %hsb by %n',
|
spec: 'change %hsb by %n',
|
||||||
category: 'colors',
|
category: 'colors',
|
||||||
defaults: ['hue', 10]
|
defaults: ['hue', 10]
|
||||||
};
|
};
|
||||||
|
@ -1749,7 +1746,7 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'reporter',
|
type: 'reporter',
|
||||||
spec: 'pen color: %hsb',
|
spec: 'color: %hsb',
|
||||||
category: 'colors'
|
category: 'colors'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1767,17 +1764,18 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'running stitch length %n',
|
spec: 'running length %n adjust %b',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
defaults: [12]
|
defaults: [12, true]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.blocks.jumpStitch =
|
this.blocks.jumpStitch =
|
||||||
{
|
{
|
||||||
only: SpriteMorph,
|
only: SpriteMorph,
|
||||||
type: 'command',
|
type: 'command',
|
||||||
spec: 'jump stitch',
|
spec: 'jump stitch %b',
|
||||||
category: 'embroidery',
|
category: 'embroidery',
|
||||||
|
defaults: [true]
|
||||||
};
|
};
|
||||||
|
|
||||||
// more blocks
|
// more blocks
|
||||||
|
@ -2006,7 +2004,11 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('setSize'));
|
blocks.push(block('setSize'));
|
||||||
blocks.push(block('changeSize'));
|
blocks.push(block('changeSize'));
|
||||||
blocks.push(block('getPenSize'));
|
blocks.push(block('getPenSize'));
|
||||||
|
blocks.push('-');
|
||||||
|
blocks.push(block('setOpacity'));
|
||||||
|
blocks.push(block('changeOpacity'));
|
||||||
|
blocks.push(block('getOpacity'));
|
||||||
|
|
||||||
} else if (cat === 'embroidery') {
|
} else if (cat === 'embroidery') {
|
||||||
|
|
||||||
|
@ -2018,10 +2020,6 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
||||||
} else if (cat === 'colors') {
|
} else if (cat === 'colors') {
|
||||||
blocks.push(block('setColor'));
|
blocks.push(block('setColor'));
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('setOpacity'));
|
|
||||||
blocks.push(block('changeOpacity'));
|
|
||||||
blocks.push(block('getOpacity'));
|
|
||||||
blocks.push('-');
|
|
||||||
blocks.push(block('setColorRGB'));
|
blocks.push(block('setColorRGB'));
|
||||||
blocks.push(block('setColorHSV'));
|
blocks.push(block('setColorHSV'));
|
||||||
blocks.push(block('setColorHex'));
|
blocks.push(block('setColorHex'));
|
||||||
|
|
|
@ -258,8 +258,6 @@ TurtleShepherd.prototype.pushColorChangeNow = function() {
|
||||||
index = this.colors.push(this.newColor)-1;
|
index = this.colors.push(this.newColor)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("change color to", c);
|
|
||||||
|
|
||||||
this.cache.push(
|
this.cache.push(
|
||||||
{
|
{
|
||||||
"cmd":"color",
|
"cmd":"color",
|
||||||
|
@ -647,12 +645,9 @@ TurtleShepherd.prototype.toDST = function(name="noname") {
|
||||||
writeHeader("+Y:" + pad(Math.round(exty1 / this.pixels_per_millimeter) * 10, 5), 9); //Math.round(this.getMetricHeight()*10), 9);
|
writeHeader("+Y:" + pad(Math.round(exty1 / this.pixels_per_millimeter) * 10, 5), 9); //Math.round(this.getMetricHeight()*10), 9);
|
||||||
writeHeader("-Y:" + pad(Math.abs(Math.round(exty2 / this.pixels_per_millimeter)) * 10, 5), 9);
|
writeHeader("-Y:" + pad(Math.abs(Math.round(exty2 / this.pixels_per_millimeter)) * 10, 5), 9);
|
||||||
|
|
||||||
|
|
||||||
var needle_end_x = this.lastX - this.initX;
|
var needle_end_x = this.lastX - this.initX;
|
||||||
var needle_end_y = this.lastY - this.initY;
|
var needle_end_y = this.lastY - this.initY;
|
||||||
|
|
||||||
console.log(pad(needle_end_x,5), needle_end_y);
|
|
||||||
|
|
||||||
writeHeader("AX:" + pad(Math.round(needle_end_x / this.pixels_per_millimeter) * 10, 6), 10);
|
writeHeader("AX:" + pad(Math.round(needle_end_x / this.pixels_per_millimeter) * 10, 6), 10);
|
||||||
writeHeader("AY:" + pad(Math.round(needle_end_y / this.pixels_per_millimeter) * 10, 6), 10);
|
writeHeader("AY:" + pad(Math.round(needle_end_y / this.pixels_per_millimeter) * 10, 6), 10);
|
||||||
writeHeader("MX:", 10);
|
writeHeader("MX:", 10);
|
||||||
|
|
Ładowanie…
Reference in New Issue