add remove highlight when stop
This commit is contained in:
		@@ -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 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user