mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-21 02:39:54 -04:00
Clicking blocks in the toolbox (#267)
This commit is contained in:
parent
dcda82a009
commit
1e86d48a31
5 changed files with 55 additions and 26 deletions
playground
|
@ -71,8 +71,9 @@ window.onload = function() {
|
|||
window.workspace = workspace;
|
||||
|
||||
// Attach scratch-blocks events to VM.
|
||||
// @todo: Re-enable flyout listening after fixing GH-69.
|
||||
workspace.addChangeListener(vm.blockListener);
|
||||
var flyoutWorkspace = workspace.getFlyout().getWorkspace();
|
||||
flyoutWorkspace.addChangeListener(vm.flyoutBlockListener);
|
||||
|
||||
// Create FPS counter.
|
||||
var stats = new window.Stats();
|
||||
|
@ -117,11 +118,9 @@ window.onload = function() {
|
|||
|
||||
// Receipt of new block XML for the selected target.
|
||||
vm.on('workspaceUpdate', function (data) {
|
||||
window.Blockly.Events.disable();
|
||||
workspace.clear();
|
||||
var dom = window.Blockly.Xml.textToDom(data.xml);
|
||||
window.Blockly.Xml.domToWorkspace(dom, workspace);
|
||||
window.Blockly.Events.enable();
|
||||
});
|
||||
|
||||
// Receipt of new list of targets, selected target update.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue