tweaked dynamic coloring and block-fading

pull/95/head
jmoenig 2020-07-21 10:52:30 +02:00
rodzic 9ed77d7cc7
commit 9dcd327f07
5 zmienionych plików z 23 dodań i 19 usunięć

Wyświetl plik

@ -4,8 +4,8 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Snap! Build Your Own Blocks 6.0.1 - dev -</title>
<link rel="shortcut icon" href="src/favicon.ico">
<script src="src/morphic.js?version=2020-07-20"></script>
<script src="src/symbols.js?version=2020-07-20"></script>
<script src="src/morphic.js?version=2020-07-21"></script>
<script src="src/symbols.js?version=2020-07-21"></script>
<script src="src/widgets.js?version=2020-07-21"></script>
<script src="src/blocks.js?version=2020-07-21"></script>
<script src="src/threads.js?version=2020-07-09"></script>

Wyświetl plik

@ -6599,7 +6599,7 @@ ScriptsMorph.prototype.getRenderColor = function () {
if (MorphicPreferences.isFlat) {
return this.color;
}
return this.color.lighter(5).mixed(
return this.color.mixed(
Math.max(SyntaxElementMorph.prototype.alpha - 0.15, 0),
SpriteMorph.prototype.paletteColor
);

Wyświetl plik

@ -1538,7 +1538,7 @@ IDE_Morph.prototype.createSpriteBar = function () {
if (MorphicPreferences.isFlat) {
return this.pressColor;
}
return this.pressColor.lighter(5).mixed(
return this.pressColor.mixed(
Math.max(SyntaxElementMorph.prototype.alpha - 0.15, 0),
SpriteMorph.prototype.paletteColor
);
@ -1794,6 +1794,17 @@ IDE_Morph.prototype.createCorral = function () {
this.corral = new Morph();
this.corral.color = this.groupColor;
this.corral.getRenderColor = function () {
if (MorphicPreferences.isFlat) {
return this.color;
}
return this.color.mixed(
Math.max(SyntaxElementMorph.prototype.alpha - 0.15, 0),
SpriteMorph.prototype.paletteColor
);
};
this.add(this.corral);
this.corral.stageIcon = new SpriteIconMorph(this.stage);

Wyświetl plik

@ -1278,7 +1278,7 @@
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
var morphicVersion = '2020-July-20';
var morphicVersion = '2020-July-21';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = true;
@ -3478,7 +3478,7 @@ Morph.prototype.getImage = function () {
};
Morph.prototype.render = function (aContext) {
aContext.fillStyle = this.color.toString();
aContext.fillStyle = this.getRenderColor().toString();
aContext.fillRect(0, 0, this.width(), this.height());
if (this.cachedTexture) {
this.renderCachedTexture(aContext);
@ -3487,6 +3487,11 @@ Morph.prototype.render = function (aContext) {
}
};
Morph.prototype.getRenderColor = function () {
// can be overriden by my heirs or instances
return this.color;
};
Morph.prototype.fixLayout = function () {
// implemented by my heirs
// determine my extent and arrange my submorphs, if any
@ -8518,11 +8523,6 @@ StringMorph.prototype.font = function () {
this.fontStyle;
};
StringMorph.prototype.getRenderColor = function () {
// answer the rendering color, can be overridden for my children
return this.color;
};
StringMorph.prototype.getShadowRenderColor = function () {
// answer the shadow rendering color, can be overridden for my children
return this.shadowColor;
@ -9359,8 +9359,6 @@ TextMorph.prototype.render = function (ctx) {
}
};
TextMorph.prototype.getRenderColor = StringMorph.prototype.getRenderColor;
TextMorph.prototype.getShadowRenderColor =
StringMorph.prototype.getShadowRenderColor;

Wyświetl plik

@ -41,7 +41,7 @@
// Global stuff ////////////////////////////////////////////////////////
modules.symbols = '2020-July-20';
modules.symbols = '2020-July-21';
var SymbolMorph;
@ -196,11 +196,6 @@ SymbolMorph.prototype.setLabelColor = function (
// SymbolMorph dynamic coloring:
SymbolMorph.prototype.getRenderColor = function () {
// answer the rendering color, can be overridden for my children
return this.color;
};
SymbolMorph.prototype.getShadowRenderColor = function () {
// answer the shadow rendering color, can be overridden for my children
return this.shadowColor;