Add play note block to default toolbox for testing

This commit is contained in:
Eric Rosenbaum 2018-10-25 10:24:21 -04:00
parent d03a3fe8f8
commit d17267bf72
2 changed files with 44 additions and 0 deletions

View file

@ -548,5 +548,17 @@ Blockly.Blocks.defaultToolbox = '<xml id="toolbox-categories" style="display: no
'</shadow>' +
'</value>' +
'</block>' +
'<block type="extension_music_play_note" id="extension_microbit_display">' +
'<value name="NOTE">' +
'<shadow type="math_number">' +
'<field name="NUM">60</field>' +
'</shadow>' +
'</value>' +
'<value name="BEATS">' +
'<shadow type="math_number">' +
'<field name="NUM">0.25</field>' +
'</shadow>' +
'</value>' +
'</block>' +
'</category>' +
'</xml>';

View file

@ -260,3 +260,35 @@ Blockly.Blocks['extension_microbit_display'] = {
});
}
};
Blockly.Blocks['extension_music_play_note'] = {
/**
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": "%1 %2 play note %3 for %4 beats",
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "extensions/music-block-icon.svg",
"width": 40,
"height": 40
},
{
"type": "field_vertical_separator"
},
{
"type": "input_value",
"name": "NOTE"
},
{
"type": "input_value",
"name": "BEATS"
}
],
"category": Blockly.Categories.pen,
"extensions": ["colours_pen", "shape_statement", "scratch_extension"]
});
}
};