tweaked block-fading coloring

pull/95/head
jmoenig 2020-07-23 18:58:08 +02:00
rodzic 8ace897acc
commit 98c192eaba
3 zmienionych plików z 16 dodań i 17 usunięć

Wyświetl plik

@ -4,7 +4,8 @@
### 2020-07-23
* morphic: fixed mouseDown events for touch devices
* morphic, gui: added separators to list morphs, '~' for the libraries dialog
* morphic, gui: added separators to list morphs, '~' for the libraries dialog
* blocks: tweaked block-fading coloring
### 2020-07-22
* morphic, blocks, gui: tweaked block-fading mouse-over

Wyświetl plik

@ -7,7 +7,7 @@
<script src="src/morphic.js?version=2020-07-23"></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-22"></script>
<script src="src/blocks.js?version=2020-07-23"></script>
<script src="src/threads.js?version=2020-07-22"></script>
<script src="src/objects.js?version=2020-07-20"></script>
<script src="src/gui.js?version=2020-07-23"></script>

Wyświetl plik

@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-July-22';
modules.blocks = '2020-July-23';
var SyntaxElementMorph;
var BlockMorph;
@ -2335,12 +2335,11 @@ BlockLabelMorph.prototype.getRenderColor = function () {
var block = this.parentThatIsA(BlockMorph);
if (MorphicPreferences.isFlat) {
return block.alpha > 0.4 ? this.color
: (block.alpha > 0.2 ? BLACK
: block.color.solid());
: block.color.solid().darker(Math.max(block.alpha * 250, 0.1));
}
return block.alpha > 0.4 ? this.color
: (block.alpha > 0.2 ? WHITE
: block.color.solid());
: block.color.solid().lighter(Math.max(block.alpha * 250, 0.1));
};
BlockLabelMorph.prototype.getShadowRenderColor = function () {
@ -2369,31 +2368,30 @@ function BlockSymbolMorph(name, size, color, shadowOffset, shadowColor) {
}
BlockSymbolMorph.prototype.getRenderColor = function () {
var block = this.parentThatIsA(BlockMorph);
if (MorphicPreferences.isFlat) {
if (this.isFading) {
return this.color.mixed(this.parent.alpha, WHITE);
return this.color.mixed(block.alpha, WHITE);
}
if (this.color.eq(WHITE)) {
return this.parent.alpha > 0.4 ? this.color
: (this.parent.alpha > 0.2 ? BLACK
: this.parent.color.solid());
return block.alpha > 0.4 ? this.color
: block.color.solid().darker(Math.max(block.alpha * 250, 0.1));
}
return this.color;
}
if (this.isFading) {
return this.color.mixed(
this.parent.alpha,
block.alpha,
SpriteMorph.prototype.paletteColor
);
}
if (this.color.eq(BLACK)) {
return this.parent.alpha > 0.4 ? this.color
: (this.parent.alpha > 0.2 ? WHITE
: this.parent.color.solid());
return block.alpha > 0.4 ? this.color
: block.color.solid().lighter(Math.max(block.alpha * 250, 0.1));
}
if (this.color.eq(WHITE)) {
return this.parent.alpha > 0.2 ? WHITE
: this.parent.color.solid();
return block.alpha > 0.4 ? this.color
: block.color.solid().lighter(Math.max(block.alpha * 250, 0.1));
}
return this.color;
};