Commit 7d48f253 authored by Madeeha's avatar Madeeha

changing the controls_if_if block to allow controls_if_elseif and...

changing the controls_if_if block to allow controls_if_elseif and controls_if_else blocks to attach to the bottom of the if block instead of in the middle of the block.
parent a5ea93a1
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -115,7 +115,7 @@ Blockly.Blocks['controls_if'] = { ...@@ -115,7 +115,7 @@ Blockly.Blocks['controls_if'] = {
decompose: function(workspace) { decompose: function(workspace) {
var containerBlock = workspace.newBlock('controls_if_if'); var containerBlock = workspace.newBlock('controls_if_if');
containerBlock.initSvg(); containerBlock.initSvg();
var connection = containerBlock.getInput('STACK').connection; var connection = containerBlock.nextConnection;
for (var i = 1; i <= this.elseifCount_; i++) { for (var i = 1; i <= this.elseifCount_; i++) {
var elseifBlock = workspace.newBlock('controls_if_elseif'); var elseifBlock = workspace.newBlock('controls_if_elseif');
elseifBlock.initSvg(); elseifBlock.initSvg();
...@@ -147,7 +147,7 @@ Blockly.Blocks['controls_if'] = { ...@@ -147,7 +147,7 @@ Blockly.Blocks['controls_if'] = {
} }
this.elseifCount_ = 0; this.elseifCount_ = 0;
// Rebuild the block's optional inputs. // Rebuild the block's optional inputs.
var clauseBlock = containerBlock.getInputTargetBlock('STACK'); var clauseBlock = containerBlock.nextConnection.targetBlock();
while (clauseBlock) { while (clauseBlock) {
switch (clauseBlock.type) { switch (clauseBlock.type) {
case 'controls_if_elseif': case 'controls_if_elseif':
...@@ -187,7 +187,7 @@ Blockly.Blocks['controls_if'] = { ...@@ -187,7 +187,7 @@ Blockly.Blocks['controls_if'] = {
* @this Blockly.Block * @this Blockly.Block
*/ */
saveConnections: function(containerBlock) { saveConnections: function(containerBlock) {
var clauseBlock = containerBlock.getInputTargetBlock('STACK'); var clauseBlock = containerBlock.nextConnection.targetBlock();
var i = 1; var i = 1;
while (clauseBlock) { while (clauseBlock) {
switch (clauseBlock.type) { switch (clauseBlock.type) {
...@@ -223,7 +223,7 @@ Blockly.Blocks['controls_if_if'] = { ...@@ -223,7 +223,7 @@ Blockly.Blocks['controls_if_if'] = {
this.setColour(Blockly.Blocks.logic.HUE); this.setColour(Blockly.Blocks.logic.HUE);
this.appendDummyInput() this.appendDummyInput()
.appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF); .appendField(Blockly.Msg.CONTROLS_IF_IF_TITLE_IF);
this.appendStatementInput('STACK'); this.setNextStatement(true);
this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP); this.setTooltip(Blockly.Msg.CONTROLS_IF_IF_TOOLTIP);
this.contextMenu = false; this.contextMenu = false;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{ {
"@metadata": { "@metadata": {
"author": "Ellen Spertus <ellen.spertus@gmail.com>", "author": "Ellen Spertus <ellen.spertus@gmail.com>",
"lastupdated": "2015-12-02 17:58:14.123458", "lastupdated": "2015-12-17 15:12:45.360661",
"locale": "en", "locale": "en",
"messagedocumentation" : "qqq" "messagedocumentation" : "qqq"
}, },
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment