blocks-fade-out support for label arrows (under construction)

pull/95/head
jmoenig 2020-07-19 10:53:51 +02:00
rodzic 429a3b00aa
commit 013712925f
4 zmienionych plików z 33 dodań i 13 usunięć

Wyświetl plik

@ -2,6 +2,9 @@
## in development:
### 2020-07-19
* blocks: blocks-fade-out support for label arrows (under construction)
### 2020-07-17
* morphic, blocks: blocks-fadeout (under construction)

Wyświetl plik

@ -7,10 +7,10 @@
<script src="src/morphic.js?version=2020-07-16"></script>
<script src="src/symbols.js?version=2020-07-01"></script>
<script src="src/widgets.js?version=2020-07-13"></script>
<script src="src/blocks.js?version=2020-07-15"></script>
<script src="src/blocks.js?version=2020-07-19"></script>
<script src="src/threads.js?version=2020-07-09"></script>
<script src="src/objects.js?version=2020-07-13"></script>
<script src="src/gui.js?version=2020-07-16"></script>
<script src="src/gui.js?version=2020-07-19"></script>
<script src="src/paint.js?version=2020-05-17"></script>
<script src="src/lists.js?version=2020-07-01"></script>
<script src="src/byob.js?version=2020-07-01"></script>

Wyświetl plik

@ -153,7 +153,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-July-17';
modules.blocks = '2020-July-19';
var SyntaxElementMorph;
var BlockMorph;
@ -8643,7 +8643,9 @@ InputSlotMorph.prototype.init = function (
arrow = new ArrowMorph(
'down',
0,
Math.max(Math.floor(this.fontSize / 6), 1)
Math.max(Math.floor(this.fontSize / 6), 1),
BLACK,
true
);
contents.fontSize = this.fontSize;
@ -10634,14 +10636,15 @@ ArrowMorph.uber = Morph.prototype;
// ArrowMorph instance creation:
function ArrowMorph(direction, size, padding, color) {
this.init(direction, size, padding, color);
function ArrowMorph(direction, size, padding, color, isBlockLabel) {
this.init(direction, size, padding, color, isBlockLabel);
}
ArrowMorph.prototype.init = function (direction, size, padding, color) {
ArrowMorph.prototype.init = function (direction, size, padding, color, isLbl) {
this.direction = direction || 'down';
this.size = size || ((size === 0) ? 0 : 50);
this.padding = padding || 0;
this.isBlockLabel = isLbl || false;
ArrowMorph.uber.init.call(this);
this.color = color || BLACK;
@ -10669,7 +10672,7 @@ ArrowMorph.prototype.render = function (ctx) {
w = this.width(),
w2 = Math.floor(w / 2);
ctx.fillStyle = this.color.toString();
ctx.fillStyle = this.getRenderColor().toString();
ctx.beginPath();
if (this.direction === 'down') {
ctx.moveTo(pad, h2);
@ -10692,6 +10695,16 @@ ArrowMorph.prototype.render = function (ctx) {
ctx.fill();
};
ArrowMorph.prototype.getRenderColor = function () {
if (this.isBlockLabel) {
if (MorphicPreferences.isFlat) {
return this.color;
}
return this.parent.alpha > 0.5 ? this.color : WHITE;
}
return this.color;
};
// TextSlotMorph //////////////////////////////////////////////////////
/*
@ -10721,7 +10734,9 @@ TextSlotMorph.prototype.init = function (
arrow = new ArrowMorph(
'down',
0,
Math.max(Math.floor(this.fontSize / 6), 1)
Math.max(Math.floor(this.fontSize / 6), 1),
BLACK,
true
);
contents.fontSize = this.fontSize;
@ -11049,7 +11064,8 @@ MultiArgMorph.prototype.init = function (
'left',
this.fontSize,
Math.max(Math.floor(this.fontSize / 6), 1),
arrowColor
arrowColor,
true
);
// right arrow:
@ -11057,7 +11073,8 @@ MultiArgMorph.prototype.init = function (
'right',
this.fontSize,
Math.max(Math.floor(this.fontSize / 6), 1),
arrowColor
arrowColor,
true
);
// control panel:

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-July-17';
modules.gui = '2020-July-19';
// Declarations
@ -3142,7 +3142,7 @@ IDE_Morph.prototype.settingsMenu = function () {
true,
alpha => {
SyntaxElementMorph.prototype.setAlphaScaled(alpha);
this.rerender();
this.changed();
}
);
},