mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Move the change block to the variables category
This commit is contained in:
parent
13c6c63daa
commit
5418843c12
3 changed files with 32 additions and 10 deletions
|
@ -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.
|
||||
|
|
|
@ -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']) {
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue