forked from marva/sumorobot-web
fix disabling control_if block
This commit is contained in:
parent
79e9683918
commit
bc5169fbf0
@ -75,7 +75,7 @@
|
||||
</xml>
|
||||
|
||||
<xml id="toolbox_no_if" style="display: none">
|
||||
<block type="controls_if"></block>
|
||||
<block type="controls_if" disabled="true"></block>
|
||||
<block type="sumorobot_move"></block>
|
||||
<block type="sumorobot_delay"></block>
|
||||
<block type="sumorobot_enemy"></block>
|
||||
|
@ -295,6 +295,8 @@ window.onload = function() {
|
||||
} else if (event.type == Blockly.Events.DELETE && event.oldXml.getAttributeNode("type").nodeValue == "controls_if") {
|
||||
/* remove the control_if block id */
|
||||
controlBlockId = "";
|
||||
/* enable the if condition block */
|
||||
workspace.updateToolbox(document.getElementById("toolbox"));
|
||||
}
|
||||
|
||||
/* only process change and move commands */
|
||||
@ -309,14 +311,10 @@ window.onload = function() {
|
||||
var xml = Blockly.Xml.workspaceToDom(workspace);
|
||||
localStorage.setItem("sumorobot.currentProgram", Blockly.Xml.domToText(xml));
|
||||
|
||||
/* if control_if is used*/
|
||||
/* if control_if block is used */
|
||||
if (controlBlockId != "") {
|
||||
/* disable the if condition block */
|
||||
workspace.updateToolbox(document.getElementById("toolbox_no_if"));
|
||||
/* if no control_if is used */
|
||||
} else {
|
||||
/* enable the if condition block */
|
||||
workspace.updateToolbox(document.getElementById("toolbox"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user