diff --git a/HISTORY.md b/HISTORY.md index 07a001d1..71cc77d9 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -51,6 +51,9 @@ * German * Chinese, thanks, Simon! +### 2021-11-10 +* objects, store: new "penColorModel" setting, can e 'hsv' or 'hsl' + ### 2021-11-09 * objects, store: refactored block-migration mechanism * gui: changed display of project name in the IDE to PROJECT (SCENE) diff --git a/snap.html b/snap.html index 076ff6e8..c99d778f 100755 --- a/snap.html +++ b/snap.html @@ -18,7 +18,7 @@ - + @@ -30,7 +30,7 @@ - + diff --git a/src/objects.js b/src/objects.js index a96f588b..7ea3fbcc 100644 --- a/src/objects.js +++ b/src/objects.js @@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/ /*jshint esversion: 6*/ -modules.objects = '2021-November-09'; +modules.objects = '2021-November-10'; var SpriteMorph; var StageMorph; @@ -185,6 +185,7 @@ SpriteMorph.prototype.enableNesting = true; SpriteMorph.prototype.enableFirstClass = true; SpriteMorph.prototype.showingExtensions = false; SpriteMorph.prototype.useFlatLineEnds = false; +SpriteMorph.prototype.penColorModel = 'hsl'; // or 'hsv' SpriteMorph.prototype.highlightColor = new Color(250, 200, 130); SpriteMorph.prototype.highlightBorder = 8; @@ -1904,7 +1905,7 @@ SpriteMorph.prototype.init = function (globals) { this.isCachingImage = true; this.isFreeForm = true; - this.cachedColorDimensions = this.color.hsl(); + this.cachedColorDimensions = this.color[this.penColorModel](); this.isDraggable = true; this.isDown = false; this.heading = 90; @@ -1935,7 +1936,7 @@ SpriteMorph.prototype.fullCopy = function (forClone) { c.primitivesCache = {}; c.paletteCache = {}; c.imageData = {}; - c.cachedColorDimensions = c.color.hsl(); + c.cachedColorDimensions = c.color[this.penColorModel](); arr = []; this.inheritedAttributes.forEach(att => arr.push(att)); c.inheritedAttributes = arr; @@ -4480,7 +4481,7 @@ SpriteMorph.prototype.setColor = function (aColor) { this.rerender(); this.silentGotoXY(x, y); } - this.cachedColorDimensions = this.color.hsl(); + this.cachedColorDimensions = this.color[this.penColorModel](); } }; @@ -7861,7 +7862,7 @@ StageMorph.prototype.init = function (globals) { this.setExtent(this.dimensions); this.isCachingImage = true; - this.cachedColorDimensions = this.color.hsl(); + this.cachedColorDimensions = this.color[this.penColorModel](); this.acceptsDrops = false; this.setColor(new Color(255, 255, 255)); this.fps = this.frameRate; @@ -9307,7 +9308,9 @@ StageMorph.prototype.setColor = function (aColor) { if (!this.color.eq(aColor, true)) { // observeAlpha this.color = aColor.copy(); this.rerender(); - this.cachedColorDimensions = this.color.hsl(); + this.cachedColorDimensions = this.color[ + SpriteMorph.prototype.penColorModel + ](); } }; diff --git a/src/store.js b/src/store.js index e2ebbc57..6a66d3af 100644 --- a/src/store.js +++ b/src/store.js @@ -63,7 +63,7 @@ Project*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2021-November-09'; +modules.store = '2021-November-10'; // XML_Serializer /////////////////////////////////////////////////////// /* @@ -408,7 +408,9 @@ SnapSerializer.prototype.loadScene = function (xmlNode, remixID) { } if (model.stage.attributes.color) { scene.stage.color = this.loadColor(model.stage.attributes.color); - scene.stage.cachedColorDimensions = scene.stage.color.hsl(); + scene.stage.cachedColorDimensions = scene.stage.color[ + SpriteMorph.prototype.penColorModel + ](); } if (model.stage.attributes.scheduled === 'true') { scene.stage.fps = 30; @@ -714,7 +716,7 @@ SnapSerializer.prototype.loadSprites = function (xmlString, ide) { } if (model.attributes.color) { sprite.color = this.loadColor(model.attributes.color); - sprite.cachedColorDimensions = sprite.color.hsl(); + sprite.cachedColorDimensions = sprite.color[sprite.penColorModel](); } if (model.attributes.pen) { sprite.penPoint = model.attributes.pen; @@ -1453,7 +1455,7 @@ SnapSerializer.prototype.loadValue = function (model, object) { } if (model.attributes.color) { v.color = this.loadColor(model.attributes.color); - v.cachedColorDimensions = v.color.hsl(); + v.cachedColorDimensions = v.color[v.penColorModel](); } if (model.attributes.pen) { v.penPoint = model.attributes.pen;