From 9b99f87556649ca34161b6011ea2710488b8685b Mon Sep 17 00:00:00 2001 From: Dominikus Herzberg Date: Wed, 17 Apr 2024 00:50:13 +0200 Subject: [PATCH 1/2] Turtle mit reset() --- clerks/Turtle/Turtle.java | 5 +++++ clerks/Turtle/turtle.js | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/clerks/Turtle/Turtle.java b/clerks/Turtle/Turtle.java index 5ac9546..ac560c2 100644 --- a/clerks/Turtle/Turtle.java +++ b/clerks/Turtle/Turtle.java @@ -66,4 +66,9 @@ Turtle lineWidth(double width) { Clerk.call(view, STR."turtle\{ID}.lineWidth('\{width}');"); return this; } + + Turtle reset() { + Clerk.call(view, STR."turtle\{ID}.reset();"); + return this; + } } diff --git a/clerks/Turtle/turtle.js b/clerks/Turtle/turtle.js index 85b35a5..1a84b30 100644 --- a/clerks/Turtle/turtle.js +++ b/clerks/Turtle/turtle.js @@ -6,11 +6,15 @@ class Turtle { } reset() { + this.ctx.reset(); this.x = this.canvas.width / 2; this.y = this.canvas.height / 2; this.angle = 0; - this.isPenDown = true; - this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + this.penDown(); + this.color("black"); + //this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + //this.ctx.beginPath(); + // this.ctx.strokeStyle = "black"; } penDown() { From a196cc134f52fa3b9d0f05b1794a6d6ac402b883 Mon Sep 17 00:00:00 2001 From: Dominikus Herzberg Date: Wed, 17 Apr 2024 00:50:52 +0200 Subject: [PATCH 2/2] Kommentarzeilen entfernt --- clerks/Turtle/turtle.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/clerks/Turtle/turtle.js b/clerks/Turtle/turtle.js index 1a84b30..091107d 100644 --- a/clerks/Turtle/turtle.js +++ b/clerks/Turtle/turtle.js @@ -12,9 +12,6 @@ class Turtle { this.angle = 0; this.penDown(); this.color("black"); - //this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); - //this.ctx.beginPath(); - // this.ctx.strokeStyle = "black"; } penDown() {