Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions blocks_vertical/default_toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<shadow type="checkbox" />' +
'</value>' +
'</block>' +
'<block type="looks_costume" />' +
'<block type="looks_backdrops" />' +
'</category>' +
'<category name="%{BKY_CATEGORY_SOUND}" id="sound" colour="#D65CD6">' +
'<block type="sound_play" id="sound_play">' +
Expand Down Expand Up @@ -513,6 +515,7 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
' </shadow>' +
' </value>' +
'</block>' +
'<block type="sound_sounds_menu" />' +
'</category>' +
'<category name="%{BKY_CATEGORY_EVENTS}" id="events" colour="#FFD500">' +
'<block type="event_whenflagclicked" id="event_whenflagclicked"></block>' +
Expand Down Expand Up @@ -548,6 +551,7 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<block type="event_whenstopclicked" />' +
'<block type="event_whenmousescrolled" />' +
'<block type="event_whenkeyhit" />' +
'<block type="event_broadcast_menu" />' +
'</category>' +
'<category name="%{BKY_CATEGORY_CONTROL}" id="control" colour="#FFAB19">' +
'<block type="control_wait" id="control_wait">' +
Expand Down Expand Up @@ -860,6 +864,7 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<shadow type="sensing_distancetomenu" />' +
'</value>' +
'</block>' +
'<block type="sensing_sprites" />' +
'</category>' +
'<category name="%{BKY_CATEGORY_OPERATORS}" id="operators" colour="#40BF4A">' +
'<block type="operator_add" id="operator_add">' +
Expand Down Expand Up @@ -1162,6 +1167,7 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'<shadow type="text" />' +
'</value>' +
'</block>' +
'<block type="operator_constant" />' +
'</category>' +
'<category name="%{BKY_PM_CATEGORY_STRINGS}" id="strings" colour="#47c18a">' +
'<block type="operator_join" id="operator_join">' +
Expand Down
21 changes: 21 additions & 0 deletions blocks_vertical/operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
});
}
};
24 changes: 24 additions & 0 deletions blocks_vertical/sensing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
});
}
};
4 changes: 4 additions & 0 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;',
Expand Down
18 changes: 16 additions & 2 deletions core/field_dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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.
*/
Expand Down
Loading