add remove highlight when stop

This commit is contained in:
Silver Kuusik 2017-10-16 23:13:27 +02:00
parent e0e42bf283
commit 892459f6e5

View File

@ -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 */