blocks-fade-out support for multi-line inputs (under construction)

pull/95/head
jmoenig 2020-07-19 11:15:19 +02:00
rodzic 013712925f
commit 58b406b8c9
2 zmienionych plików z 50 dodań i 3 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
### 2020-07-19 ### 2020-07-19
* blocks: blocks-fade-out support for label arrows (under construction) * blocks: blocks-fade-out support for label arrows (under construction)
* blocks: blocks-fade-out support for multi-line inputs (under construction)
### 2020-07-17 ### 2020-07-17
* morphic, blocks: blocks-fadeout (under construction) * morphic, blocks: blocks-fadeout (under construction)

Wyświetl plik

@ -68,6 +68,7 @@
StringMorph* StringMorph*
BlockLabelMorph BlockLabelMorph
InputSlotStringMorph InputSlotStringMorph
InputSlotTextMorph
* from morphic.js * from morphic.js
@ -91,6 +92,7 @@
CSlotMorph CSlotMorph
InputSlotMorph InputSlotMorph
InputSlotStringMorph InputSlotStringMorph
InputSlotTextMorph
BooleanSlotMorph BooleanSlotMorph
ArrowMorph ArrowMorph
TextSlotMorph TextSlotMorph
@ -166,6 +168,7 @@ var CommandSlotMorph;
var CSlotMorph; var CSlotMorph;
var InputSlotMorph; var InputSlotMorph;
var InputSlotStringMorph; var InputSlotStringMorph;
var InputSlotTextMorph;
var BooleanSlotMorph; var BooleanSlotMorph;
var ArrowMorph; var ArrowMorph;
var ColorSlotMorph; var ColorSlotMorph;
@ -9895,6 +9898,49 @@ InputSlotStringMorph.prototype.getShadowRenderColor = function () {
return this.parent.alpha > 0.6 ? this.shadowColor : CLEAR; return this.parent.alpha > 0.6 ? this.shadowColor : CLEAR;
}; };
// InputSlotTextMorph ///////////////////////////////////////////////
/*
I am a piece of multi-line text inside an input slot block. I serve as a
container for sharing typographic attributes among my instances
*/
// InputSlotTextMorph inherits from TextMorph:
InputSlotTextMorph.prototype = new TextMorph();
InputSlotTextMorph.prototype.constructor = InputSlotTextMorph;
InputSlotTextMorph.uber = StringMorph.prototype;
function InputSlotTextMorph(
text,
fontSize,
fontStyle,
bold,
italic,
alignment,
width,
fontName,
shadowOffset,
shadowColor
) {
this.init(text,
fontSize,
fontStyle,
bold,
italic,
alignment,
width,
fontName,
shadowOffset,
shadowColor);
}
InputSlotTextMorph.prototype.getRenderColor =
InputSlotStringMorph.prototype.getRenderColor;
InputSlotTextMorph.prototype.getShadowRenderColor =
InputSlotStringMorph.prototype.getShadowRenderColor;
// TemplateSlotMorph /////////////////////////////////////////////////// // TemplateSlotMorph ///////////////////////////////////////////////////
/* /*
@ -10700,7 +10746,7 @@ ArrowMorph.prototype.getRenderColor = function () {
if (MorphicPreferences.isFlat) { if (MorphicPreferences.isFlat) {
return this.color; return this.color;
} }
return this.parent.alpha > 0.5 ? this.color : WHITE; return SyntaxElementMorph.prototype.alpha > 0.5 ? this.color : WHITE;
} }
return this.color; return this.color;
}; };
@ -10724,13 +10770,13 @@ function TextSlotMorph(text, isNumeric, choiceDict, isReadOnly) {
this.init(text, isNumeric, choiceDict, isReadOnly); this.init(text, isNumeric, choiceDict, isReadOnly);
} }
TextSlotMorph.prototype.init = function ( TextSlotMorph.prototype.init = function ( // +++
text, text,
isNumeric, isNumeric,
choiceDict, choiceDict,
isReadOnly isReadOnly
) { ) {
var contents = new TextMorph(''), var contents = new InputSlotTextMorph(''),
arrow = new ArrowMorph( arrow = new ArrowMorph(
'down', 'down',
0, 0,