From f0f63ee52ae81d2b634a834df249f4f6b2be8513 Mon Sep 17 00:00:00 2001 From: Michael Aschauer Date: Mon, 5 Nov 2018 14:32:48 +0100 Subject: [PATCH] update tatami --- stitchcode/gui.js | 2 +- stitchcode/locales/lang-de.js | 23 +++++++++++------------ stitchcode/objects.js | 28 +++++++++++++++++++++++----- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/stitchcode/gui.js b/stitchcode/gui.js index 0e3063fa..ad5de4b7 100644 --- a/stitchcode/gui.js +++ b/stitchcode/gui.js @@ -1524,7 +1524,7 @@ IDE_Morph.prototype.createCategories = function () { } SpriteMorph.prototype.categories.forEach(function (cat) { - if (!contains(['sound','looks','lists'], cat)) { + if (!contains(['asdf','asdf','lists'], cat)) { addCategoryButton(cat); } }); diff --git a/stitchcode/locales/lang-de.js b/stitchcode/locales/lang-de.js index 7aa12bb9..11c11292 100644 --- a/stitchcode/locales/lang-de.js +++ b/stitchcode/locales/lang-de.js @@ -9,17 +9,14 @@ */ tempDict = { - // UI stuff + + // UI strings 'About Snap!...': '\u00dcber Snap!...', 'About TurtleStitch...': '\u00dcber TurtleStitch!...', 'About TurtleStitch': ' \u00dcber TurtleStitch', - 'Save to Disk': - 'Sichern auf Festplatte', - 'Save to Disk': - 'Sichern auf Festplatte', ' Stitches : ': ' Stiche : ', 'Jumps': @@ -36,8 +33,6 @@ tempDict = { 'passend zoomen', 'Size : ': 'Gr\u00f6\u00dfe : ', - 'clear': - 'l\u00f6schen', 'Imperial units': 'Ang/Amerik. Einheiten', 'Turtle': @@ -69,7 +64,9 @@ tempDict = { 'Ignore colors during export': 'Ignoriere Farben beim Export', - // new blocks + // legacy blocks + 'clear': + 'l\u00f6schen', 'move %n steps by %n steps': 'gehe %n Schritte in %n er Schritten', 'move %n steps in %n': @@ -78,6 +75,8 @@ tempDict = { 'gehe zu x: %n y: %n in %n er Schritten', 'go to x: %n y: %n in %n': 'gehe zu x: %n y: %n in %n Stichen', + + // new blocks 'point towards x: %n y: %n': 'zeige nach x: %n y: %n', 'reset': @@ -135,7 +134,7 @@ tempDict = { 'Colors': 'Farben', - // embroidery stuff + // embroidery blocks and stuff 'running stitch by %n steps': ' Laufstich in %n er Schritten', 'triple run by %n': @@ -147,17 +146,17 @@ tempDict = { 'Z-stitch with density %n width %n center %b': 'Z-Sitch mit Dichte %n Breite %n zentriert %b', 'satin stitch with width %n center %b': - 'Plattstitch mit Breite %n zentriert %b', + 'Satinstich mit Breite %n zentriert %b', 'tatami stitch width %n interval %n offset %n center %b': 'Tatami-Stich mit Breite %n Intervall %n Versatz %n zentriert %b', 'jump stitch %b': 'Sprungstich %b', 'tie stitch': - 'Riegelstich', + 'Vern\u00e4hstich', 'trim': 'schneiden', 'stop running': - 'stop Lauf', + 'stop', 'draw text: %s scale: %n font: %n': 'Schreibe %s Skalierung: %n Schrift %n', diff --git a/stitchcode/objects.js b/stitchcode/objects.js index 7c9f56e9..00270b66 100644 --- a/stitchcode/objects.js +++ b/stitchcode/objects.js @@ -396,7 +396,7 @@ SpriteMorph.prototype.tatamiStitch = function (width=100, interval=30, offset=10 this.stitchoptions = { autoadjust: true, width: width, - length: 5, + length: 2, center: center, interval: Math.max(10,interval), offset: Math.min(offset,interval), @@ -615,18 +615,19 @@ SpriteMorph.prototype.ZForwardEnd = function (steps, width=10) { SpriteMorph.prototype.tatamiForward = function (steps, width=100) { // just for move to the next line in 2 bz 10 - b = this.stitchoptions.offset/2; - var c = Math.sqrt(steps/2*steps/2 + b * b); - var alpha = degrees(Math.asin((steps/2)/c)); var offset = (this.stitchoptions.segment_count % Math.floor(this.stitchoptions.interval / this.stitchoptions.offset)) * this.stitchoptions.offset; + + b = Math.max(2, offset + this.stitchoptions.offset / 2) + var c = Math.sqrt(steps/2*steps/2 + b * b); + var alpha = degrees(Math.asin((steps/2)/c)); + var distance = width - b - offset; var interval = this.stitchoptions.interval; var count = Math.floor(distance / interval); var rest = distance - (count * interval); - this.turn(90 - alpha); this.doMoveForward(c); this.turn(alpha); @@ -641,6 +642,22 @@ SpriteMorph.prototype.tatamiForward = function (steps, width=100) { if (rest) { this.doMoveForward(rest); } + + this.stitchoptions.segment_count+=1; + + offset = (this.stitchoptions.segment_count % Math.floor(this.stitchoptions.interval / this.stitchoptions.offset)) * + this.stitchoptions.offset; + + b = Math.max(2, offset + this.stitchoptions.offset / 2) + c = Math.sqrt(steps/2*steps/2 + b * b); + alpha = degrees(Math.asin((steps/2)/c)); + + distance = width - b - offset; + interval = this.stitchoptions.interval; + count = Math.floor(distance / interval); + rest = distance - (count * interval); + + this.turnLeft(180 - alpha); this.doMoveForward(c); this.turnLeft(alpha); @@ -655,6 +672,7 @@ SpriteMorph.prototype.tatamiForward = function (steps, width=100) { this.doMoveForward(rest); } this.turn(90); + this.stitchoptions.segment_count+=1; }