diff --git a/blocks_vertical/default_toolbox.js b/blocks_vertical/default_toolbox.js index cdf02d8394..fec85ee159 100644 --- a/blocks_vertical/default_toolbox.js +++ b/blocks_vertical/default_toolbox.js @@ -389,6 +389,8 @@ Blockly.Blocks.defaultToolbox = '' + '' + '' + + '' + + '' + '' + '' + '' + @@ -513,6 +515,7 @@ Blockly.Blocks.defaultToolbox = '' + '' + '' + '' + @@ -548,6 +551,7 @@ Blockly.Blocks.defaultToolbox = '' + '' + '' + + '' + '' + '' + '' + @@ -860,6 +864,7 @@ Blockly.Blocks.defaultToolbox = '' + '' + '' + + '' + '' + '' + '' + @@ -1162,6 +1167,7 @@ Blockly.Blocks.defaultToolbox = '' + '' + '' + + '' + '' + '' + '' + diff --git a/blocks_vertical/operators.js b/blocks_vertical/operators.js index 9581322ae8..ae6cdeb6de 100644 --- a/blocks_vertical/operators.js +++ b/blocks_vertical/operators.js @@ -1662,4 +1662,25 @@ Blockly.Blocks["operator_decode"] = { "extensions": ["colours_operators_strings", "output_string"] }); } +}; + +Blockly.Blocks["operator_constant"] = { + init: function() { + this.jsonInit({ + "message0": "%1", + "args0": [ + { + "type": "field_dropdown", + "name": "CONSTANT", + "options": [ + ["π", "pi"], + ["e", "euler"], + ["φ", "goldenratio"] + ] + }, + ], + "category": Blockly.Categories.operators, + "extensions": ["colours_operators", "output_number"] + }); + } }; \ No newline at end of file diff --git a/blocks_vertical/sensing.js b/blocks_vertical/sensing.js index e0755c05b2..fcf0fe492e 100644 --- a/blocks_vertical/sensing.js +++ b/blocks_vertical/sensing.js @@ -1109,3 +1109,27 @@ Blockly.Blocks['sensing_getxyoftouchingsprite'] = { }); } }; + +Blockly.Blocks['sensing_sprites'] = { + /** + * Block to set drag mode. + * @this Blockly.Block + */ + init: function() { + this.jsonInit({ + "message0": "%1", + "args0": [ + { + "type": "field_dropdown", + "name": "SPRITE", + "options": [ + ['Sprite1', 'Sprite1'], + ['Sprite2', 'Sprite2'] + ] + } + ], + "category": Blockly.Categories.sensing, + "extensions": ["colours_sensing", "output_string"] + }); + } +}; \ No newline at end of file diff --git a/core/css.js b/core/css.js index 8023b7191e..bdca60d261 100644 --- a/core/css.js +++ b/core/css.js @@ -513,6 +513,10 @@ Blockly.Css.CONTENT = [ '.blocklyEditableText>text {', 'fill: $colour_textFieldText;', '}', + '.blocklyNonEditableText,', + '.blocklyEditableText {', + 'background: #0000;', // dumb thing to make cursor work with no background + '}', '.blocklyEditableText>.blocklyEditableLabel {', 'fill: #fff;', diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 47b7ceb66b..afebce0fcd 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -148,7 +148,8 @@ Blockly.FieldDropdown.prototype.init = function() { 'stroke': this.sourceBlock_.getColourTertiary(), 'fill': this.sourceBlock_.getColour(), 'class': 'blocklyBlockBackground', - 'fill-opacity': 1 + 'fill-opacity': 1, + 'opacity': this.sourceBlock_.inputList.length === 1 && this.sourceBlock_.inputList[0].fieldRow.length === 1 ? 0 : 1 }, null); this.fieldGroup_.insertBefore(this.box_, this.textElement_); } @@ -443,7 +444,7 @@ Blockly.FieldDropdown.prototype.positionArrow = function(x) { this.arrowX_ = x + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING / 2; addedWidth = this.arrowSize_ + Blockly.BlockSvg.DROPDOWN_ARROW_PADDING; } - if (this.box_) { + if (this.box_ && !(this.sourceBlock_.inputList.length === 1 && this.sourceBlock_.inputList[0].fieldRow.length === 1)) { // Bump positioning to the right for a box-type drop-down. this.arrowX_ += Blockly.BlockSvg.BOX_FIELD_PADDING; } @@ -452,6 +453,19 @@ Blockly.FieldDropdown.prototype.positionArrow = function(x) { return addedWidth; }; +Blockly.FieldDropdown.prototype.updateWidth = function() { + Blockly.FieldDropdown.superClass_.updateWidth.call(this); + + var width = this.size_.width; + + // remove padding + if (this.box_ && this.sourceBlock_.inputList.length === 1 && this.sourceBlock_.inputList[0].fieldRow.length === 1) { + width -= 2 * Blockly.BlockSvg.BOX_FIELD_PADDING; + } + + this.size_.width = width; +}; + /** * Close the dropdown menu if this input is being deleted. */