diff --git a/blocks/math.js b/blocks/math.js index 475fd6ce2..053b5458f 100644 --- a/blocks/math.js +++ b/blocks/math.js @@ -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. diff --git a/core/variables.js b/core/variables.js index 3bc77f0e3..c5c5e22fb 100644 --- a/core/variables.js +++ b/core/variables.js @@ -117,14 +117,43 @@ Blockly.Variables.flyoutCategory = function(workspace) { // 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']) { + // + // + // + // 1 + // + // + // + 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']) { diff --git a/tests/playground.html b/tests/playground.html index e7e6e1166..144b4f4e7 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -472,13 +472,6 @@ h1 { - - - - 1 - - -