Move the change block to the variables category

This commit is contained in:
Rachel Fenichel 2016-07-01 16:17:30 -07:00
parent 13c6c63daa
commit 5418843c12
3 changed files with 32 additions and 10 deletions

View file

@ -325,7 +325,7 @@ Blockly.Blocks['math_change'] = {
],
"previousStatement": null,
"nextStatement": null,
"colour": Blockly.Blocks.math.HUE,
"colour": Blockly.Blocks.variables.HUE,
"helpUrl": Blockly.Msg.MATH_CHANGE_HELPURL
});
// Assign 'this' to a variable for use in the tooltip closure below.

View file

@ -117,14 +117,43 @@ Blockly.Variables.flyoutCategory = function(workspace) {
// </block>
var block = goog.dom.createDom('block');
block.setAttribute('type', 'variables_set');
if (Blockly.Blocks['variables_get']) {
block.setAttribute('gap', 20);
if (Blockly.Blocks['math_change']) {
block.setAttribute('gap', 8);
} else {
block.setAttribute('gap', 24);
}
var field = goog.dom.createDom('field', null, variableList[0]);
field.setAttribute('name', 'VAR');
block.appendChild(field);
xmlList.push(block);
}
if (Blockly.Blocks['math_change']) {
// <block type="math_change">
// <value name="DELTA">
// <shadow type="math_number">
// <field name="NUM">1</field>
// </shadow>
// </value>
// </block>
var block = goog.dom.createDom('block');
block.setAttribute('type', 'math_change');
if (Blockly.Blocks['variables_get']) {
block.setAttribute('gap', 20);
}
var value = goog.dom.createDom('value');
value.setAttribute('name', 'DELTA');
block.appendChild(value);
var shadowBlock = goog.dom.createDom('shadow');
shadowBlock.setAttribute('type', 'math_number');
value.appendChild(shadowBlock);
var field = goog.dom.createDom('field', null, '1');
field.setAttribute('name', 'NUM');
shadowBlock.appendChild(field);
xmlList.push(block);
}
for (var i = 0; i < variableList.length; i++) {
if (Blockly.Blocks['variables_get']) {

View file

@ -472,13 +472,6 @@ h1 {
</shadow>
</value>
</block>
<block type="math_change">
<value name="DELTA">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
<block type="math_round">
<value name="NUM">
<shadow type="math_number">