diff --git a/sumorobot.js b/sumorobot.js index 7e1a153..0adf185 100755 --- a/sumorobot.js +++ b/sumorobot.js @@ -9,6 +9,8 @@ var sumostart = false; var sumorobot = null; /* Blockly workspace */ var workspace = null; +/* last hightlighted block */ +var highlighted = ""; /* disable enable hotkeys */ var hotkeys = true; /* the sumorobot code */ @@ -50,6 +52,7 @@ Sumorobot.prototype.connect = function() { /* when scope is received */ if (evt.data.length == 20) { workspace.highlightBlock(evt.data); + highlighted = evt.data; } else { console.log(evt.data); } @@ -388,6 +391,9 @@ window.onload = function() { $(".btn-stop").click(function() { sumostart = false; sumorobot.send("stop"); + setTimeout(function() { + workspace.highlightBlock(highlighted, false); + }, 500); }); /* remote control checkbox listener */