forked from marva/sumorobot-web
add remove highlight when stop
This commit is contained in:
parent
e0e42bf283
commit
892459f6e5
@ -9,6 +9,8 @@ var sumostart = false;
|
|||||||
var sumorobot = null;
|
var sumorobot = null;
|
||||||
/* Blockly workspace */
|
/* Blockly workspace */
|
||||||
var workspace = null;
|
var workspace = null;
|
||||||
|
/* last hightlighted block */
|
||||||
|
var highlighted = "";
|
||||||
/* disable enable hotkeys */
|
/* disable enable hotkeys */
|
||||||
var hotkeys = true;
|
var hotkeys = true;
|
||||||
/* the sumorobot code */
|
/* the sumorobot code */
|
||||||
@ -50,6 +52,7 @@ Sumorobot.prototype.connect = function() {
|
|||||||
/* when scope is received */
|
/* when scope is received */
|
||||||
if (evt.data.length == 20) {
|
if (evt.data.length == 20) {
|
||||||
workspace.highlightBlock(evt.data);
|
workspace.highlightBlock(evt.data);
|
||||||
|
highlighted = evt.data;
|
||||||
} else {
|
} else {
|
||||||
console.log(evt.data);
|
console.log(evt.data);
|
||||||
}
|
}
|
||||||
@ -388,6 +391,9 @@ window.onload = function() {
|
|||||||
$(".btn-stop").click(function() {
|
$(".btn-stop").click(function() {
|
||||||
sumostart = false;
|
sumostart = false;
|
||||||
sumorobot.send("stop");
|
sumorobot.send("stop");
|
||||||
|
setTimeout(function() {
|
||||||
|
workspace.highlightBlock(highlighted, false);
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* remote control checkbox listener */
|
/* remote control checkbox listener */
|
||||||
|
Loading…
Reference in New Issue
Block a user