Support passing renderer overrides in options (#3734)

* Support passing in renderer options through workspace options.
This commit is contained in:
Sam El-Husseini
2020-03-10 18:36:29 -07:00
committed by GitHub
parent a9e10807ca
commit 13ac939b91
22 changed files with 176 additions and 170 deletions

View File

@@ -128,7 +128,7 @@ Blockly.FieldTextInput.prototype.configure_ = function(config) {
* @override
*/
Blockly.FieldTextInput.prototype.initView = function() {
if (this.constants_.FULL_BLOCK_FIELDS) {
if (this.getConstants().FULL_BLOCK_FIELDS) {
// Step one: figure out if this is the only field on this block.
// Rendering is quite different in that case.
var nFields = 0;
@@ -216,13 +216,13 @@ Blockly.FieldTextInput.prototype.doValueUpdate_ = function(newValue) {
* @package
*/
Blockly.FieldTextInput.prototype.applyColour = function() {
if (this.sourceBlock_ && this.constants_.FULL_BLOCK_FIELDS) {
if (this.sourceBlock_ && this.getConstants().FULL_BLOCK_FIELDS) {
if (this.borderRect_) {
this.borderRect_.setAttribute('stroke',
this.sourceBlock_.style.colourTertiary);
} else {
this.sourceBlock_.pathObject.svgPath.setAttribute('fill',
this.constants_.FIELD_BORDER_RECT_COLOUR);
this.getConstants().FIELD_BORDER_RECT_COLOUR);
}
}
};
@@ -332,7 +332,7 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() {
htmlInput.setAttribute('spellcheck', this.spellcheck_);
var scale = this.workspace_.scale;
var fontSize =
(this.constants_.FIELD_TEXT_FONTSIZE * scale) + 'pt';
(this.getConstants().FIELD_TEXT_FONTSIZE * scale) + 'pt';
div.style.fontSize = fontSize;
htmlInput.style.fontSize = fontSize;
var borderRadius =
@@ -350,7 +350,7 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() {
htmlInput.style.border = (1 * scale) + 'px solid ' + strokeColour;
div.style.borderRadius = borderRadius;
div.style.transition = 'box-shadow 0.25s ease 0s';
if (this.constants_.FIELD_TEXTINPUT_BOX_SHADOW) {
if (this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW) {
div.style.boxShadow = 'rgba(255, 255, 255, 0.3) 0px 0px 0px ' +
4 * scale + 'px';
}