From de29bffe159d40ead33a42e00a9544d17a187554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Fri, 7 Jul 2017 16:06:46 +0200 Subject: [PATCH] confine turtle direction readout to 0-360 degrees addresses a bug report from Cynthia Solomon --- history.txt | 1 + morphic.js | 4 ++-- objects.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/history.txt b/history.txt index db068f33..7ea8a40b 100755 --- a/history.txt +++ b/history.txt @@ -3509,6 +3509,7 @@ Fixes: ------ * Objects, GUI, Store: tweak naming of instantiating to “clone”, enable inheritance by default * Objects, GUI: run “When I start as clone” scripts when manually cloning a sprite, only position at hand pointer if no such scripts exist +* Morphic, Objects: confine turtle direction readout to 0-360 degrees, thanks, Cynthia for the bug report!! Features: diff --git a/morphic.js b/morphic.js index b6259eff..36807ec5 100644 --- a/morphic.js +++ b/morphic.js @@ -1161,7 +1161,7 @@ /*global window, HTMLCanvasElement, FileReader, Audio, FileList*/ -var morphicVersion = '2017-July-04'; +var morphicVersion = '2017-July-07'; var modules = {}; // keep track of additional loaded modules var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug @@ -4838,7 +4838,7 @@ PenMorph.prototype.drawNew = function (facing) { // PenMorph access: PenMorph.prototype.setHeading = function (degrees) { - this.heading = parseFloat(degrees) % 360; + this.heading = ((+degrees % 360) + 360) % 360; this.drawNew(); this.changed(); }; diff --git a/objects.js b/objects.js index b79fcec0..e5c62bdd 100644 --- a/objects.js +++ b/objects.js @@ -4262,7 +4262,7 @@ SpriteMorph.prototype.setHeading = function (degrees, noShadow) { this.silentGotoXY(x, y, true); // just me this.positionTalkBubble(); } else { - this.heading = parseFloat(degrees) % 360; + this.heading = ((+degrees % 360) + 360) % 360; } // propagate to my parts