renamed internal pen color channel cache

snap7
jmoenig 2021-11-08 09:01:42 +01:00
rodzic 611518be00
commit 474ba9499b
4 zmienionych plików z 19 dodań i 18 usunięć

Wyświetl plik

@ -51,6 +51,7 @@
### 2021-11-08
* objects: renamed some internal color methods
* objects, store: renamed internal pen color channel cache
### 2021-11-07
* widgets, blocks, byob: allow block-instances to be dragged off from templates in the "hide blocks" dialog

Wyświetl plik

@ -30,7 +30,7 @@
<script src="src/maps.js?version=2021-06-15"></script>
<script src="src/extensions.js?version=2021-10-06"></script>
<script src="src/xml.js?version=2021-07-05"></script>
<script src="src/store.js?version=2021-10-22"></script>
<script src="src/store.js?version=2021-11-08"></script>
<script src="src/locale.js?version=2021-10-28"></script>
<script src="src/cloud.js?version=2021-02-04"></script>
<script src="src/api.js?version=2021-07-05"></script>

Wyświetl plik

@ -1843,8 +1843,8 @@ SpriteMorph.prototype.init = function (globals) {
// frequency player, experimental
this.freqPlayer = null; // Note, to be lazily initialized
// pen hsv color support
this.cachedHSV = [0, 0, 0]; // not serialized
// pen color dimensions support
this.cachedColorChannels = [0, 0, 0]; // not serialized
// only temporarily for serialization
this.inheritedMethodsCache = [];
@ -1893,7 +1893,7 @@ SpriteMorph.prototype.init = function (globals) {
this.isCachingImage = true;
this.isFreeForm = true;
this.cachedHSV = this.color.hsv();
this.cachedColorChannels = this.color.hsv();
this.isDraggable = true;
this.isDown = false;
this.heading = 90;
@ -1924,7 +1924,7 @@ SpriteMorph.prototype.fullCopy = function (forClone) {
c.primitivesCache = {};
c.paletteCache = {};
c.imageData = {};
c.cachedHSV = c.color.hsv();
c.cachedColorChannels = c.color.hsv();
arr = [];
this.inheritedAttributes.forEach(att => arr.push(att));
c.inheritedAttributes = arr;
@ -4433,8 +4433,8 @@ SpriteMorph.prototype.setColorComponentHSVA = function (idx, num) {
if (idx === 3) {
this.color.a = 1 - n / 100;
} else {
this.cachedHSV[idx] = n / 100;
this.color.set_hsv.apply(this.color, this.cachedHSV);
this.cachedColorChannels[idx] = n / 100;
this.color.set_hsv.apply(this.color, this.cachedColorChannels);
}
if (!this.costume) {
this.rerender();
@ -4447,7 +4447,7 @@ SpriteMorph.prototype.getColorComponentHSVA = function (idx) {
if (idx === 3) {
return (1 - this.color.a) * 100;
}
return (this.cachedHSV[idx] || 0) * 100;
return (this.cachedColorChannels[idx] || 0) * 100;
};
SpriteMorph.prototype.changeColorComponentHSVA = function (idx, delta) {
@ -4466,7 +4466,7 @@ SpriteMorph.prototype.setColor = function (aColor) {
this.rerender();
this.silentGotoXY(x, y);
}
this.cachedHSV = this.color.hsv();
this.cachedColorChannels = this.color.hsv();
}
};
@ -7793,7 +7793,7 @@ StageMorph.prototype.init = function (globals) {
this.scale = 1; // for display modes, do not persist
this.cachedHSV = [0, 0, 0]; // for background hsv support, not serialized
this.cachedColorChannels = [0, 0, 0]; // bg color channel support, not serialized
this.keysPressed = {}; // for handling keyboard events, do not persist
this.primitivesCache = {}; // not to be serialized (!)
@ -7847,7 +7847,7 @@ StageMorph.prototype.init = function (globals) {
this.setExtent(this.dimensions);
this.isCachingImage = true;
this.cachedHSV = this.color.hsv();
this.cachedColorChannels = this.color.hsv();
this.acceptsDrops = false;
this.setColor(new Color(255, 255, 255));
this.fps = this.frameRate;
@ -9277,8 +9277,8 @@ StageMorph.prototype.setColorComponentHSVA = function (idx, num) {
if (idx === 3) {
this.color.a = 1 - n / 100;
} else {
this.cachedHSV[idx] = n / 100;
this.color.set_hsv.apply(this.color, this.cachedHSV);
this.cachedColorChannels[idx] = n / 100;
this.color.set_hsv.apply(this.color, this.cachedColorChannels);
}
this.rerender();
};
@ -9293,7 +9293,7 @@ StageMorph.prototype.setColor = function (aColor) {
if (!this.color.eq(aColor, true)) { // observeAlpha
this.color = aColor.copy();
this.rerender();
this.cachedHSV = this.color.hsv();
this.cachedColorChannels = this.color.hsv();
}
};

Wyświetl plik

@ -63,7 +63,7 @@ Project*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2021-October-22';
modules.store = '2021-November-08';
// XML_Serializer ///////////////////////////////////////////////////////
/*
@ -408,7 +408,7 @@ SnapSerializer.prototype.loadScene = function (xmlNode, remixID) {
}
if (model.stage.attributes.color) {
scene.stage.color = this.loadColor(model.stage.attributes.color);
scene.stage.cachedHSV = scene.stage.color.hsv();
scene.stage.cachedColorChannels = scene.stage.color.hsv();
}
if (model.stage.attributes.scheduled === 'true') {
scene.stage.fps = 30;
@ -714,7 +714,7 @@ SnapSerializer.prototype.loadSprites = function (xmlString, ide) {
}
if (model.attributes.color) {
sprite.color = this.loadColor(model.attributes.color);
sprite.cachedHSV = sprite.color.hsv();
sprite.cachedColorChannels = sprite.color.hsv();
}
if (model.attributes.pen) {
sprite.penPoint = model.attributes.pen;
@ -1453,7 +1453,7 @@ SnapSerializer.prototype.loadValue = function (model, object) {
}
if (model.attributes.color) {
v.color = this.loadColor(model.attributes.color);
v.cachedHSV = v.color.hsv();
v.cachedColorChannels = v.color.hsv();
}
if (model.attributes.pen) {
v.penPoint = model.attributes.pen;