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 ### 2020-07-23
* morphic: fixed mouseDown events for touch devices * 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 ### 2020-07-22
* morphic, blocks, gui: tweaked block-fading mouse-over * 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/morphic.js?version=2020-07-23"></script>
<script src="src/symbols.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/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/threads.js?version=2020-07-22"></script>
<script src="src/objects.js?version=2020-07-20"></script> <script src="src/objects.js?version=2020-07-20"></script>
<script src="src/gui.js?version=2020-07-23"></script> <script src="src/gui.js?version=2020-07-23"></script>

Wyświetl plik

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