Adding controls_ifelse block (#722)

Adding controls_ifelse, an if/else block that is loaded from JSON and does not use mutators. This gives "else" capability to Android & iOS implementations, which don't support JavaScript mutators.

Added this block to the playground simple toolbox and all generators.
This commit is contained in:
Andrew n marshall
2016-10-31 11:00:39 -07:00
committed by GitHub
parent 0156f2e103
commit 72ff6d9ead
8 changed files with 115 additions and 63 deletions

View File

@@ -265,6 +265,42 @@ Blockly.Blocks['controls_if_else'] = {
}
};
Blockly.Blocks['controls_ifelse'] = {
/**
* If/else block that does not use a mutator.
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CONTROLS_IFELSE_TITLE,
"args0": [
{
"type": "input_value",
"name": "IF0",
"check": "Boolean",
"align": "RIGHT"
},
{
"type": "input_statement",
"name": "DO0",
"check": "Boolean",
"align": "RIGHT"
},
{
"type": "input_statement",
"name": "ELSE",
"check": "Boolean",
"align": "RIGHT"
}
],
"previousStatement": null,
"nextStatement": null,
"colour": Blockly.Blocks.logic.HUE,
"tooltip": Blockly.Msg.CONTROLS_IF_TOOLTIP_2,
"helpUrl": Blockly.Msg.CONTROLS_IF_HELPURL
});
}
};
Blockly.Blocks['logic_compare'] = {
/**
* Block for comparison operator.