From 1ff20b30b1243b0a5f4a47f034b25ca541e87706 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 5 Oct 2018 09:48:11 +0200 Subject: [PATCH] Adjusted pen hue wrapping and took out pen shade wrapping --- HISTORY.md | 3 +++ snap.html | 2 +- src/objects.js | 13 +++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 5478dbe3..f38bc178 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,9 @@ ## Development Version +### 2018-10-05 +* Objects: Adjusted pen hue wrapping and took out pen shade wrapping + ### 2018-10-04 * GUI, Cloud: improved UX when running Snap! locally without a web server * pushed dev-version to v4.2.2 diff --git a/snap.html b/snap.html index 97810eb7..697c3ca9 100755 --- a/snap.html +++ b/snap.html @@ -8,7 +8,7 @@ - + diff --git a/src/objects.js b/src/objects.js index cc636f9b..137e0faf 100644 --- a/src/objects.js +++ b/src/objects.js @@ -83,7 +83,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize, TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph, AlignmentMorph, Process, XML_Element, VectorPaintEditorMorph*/ -modules.objects = '2018-October-04'; +modules.objects = '2018-October-05'; var SpriteMorph; var StageMorph; @@ -3537,7 +3537,10 @@ SpriteMorph.prototype.setHue = function (num) { y = this.yPosition(), n = +num; - hsv[0] = (n < 0 ? 100 : 0) + n % 100 / 100; + if (n < 0 || n > 100) { // wrap the hue + n = (n < 0 ? 100 : 0) + n % 100; + } + hsv[0] = n / 100; // hsv[0] = Math.max(Math.min(+num || 0, 100), 0) / 100; // old code hsv[1] = 1; // we gotta fix this at some time this.color.set_hsv.apply(this.color, hsv); @@ -3559,12 +3562,10 @@ SpriteMorph.prototype.getBrightness = function () { SpriteMorph.prototype.setBrightness = function (num) { var hsv = this.color.hsv(), x = this.xPosition(), - y = this.yPosition(), - n = +num; + y = this.yPosition(); hsv[1] = 1; // we gotta fix this at some time - // hsv[2] = Math.max(Math.min(+num || 0, 100), 0) / 100; // old code - hsv[2] = (n < 0 ? 100 : 0) + n % 100 / 100; + hsv[2] = Math.max(Math.min(+num || 0, 100), 0) / 100; // shade doesn't wrap this.color.set_hsv.apply(this.color, hsv); if (!this.costume) { this.drawNew();