pathfinder/src/highlighting.js
//Return to original colour when mouse leaves

Return to original colour when mouse leaves
Return to original colour when mouse leaves
function unHighlight() {
    nodeID = getid(this);
    for(i=0; i<y; i++){
        for(j=0; j<x; j++){
            if (grid[i][j].id === nodeID){
                if(grid[i][j].start == false && grid[i][j].end == false && grid[i][j].wall == false) {           
                    document.getElementById(nodeID).style = 'background-color: f0f0f0';
                }
                if(grid[i][j].animated == true) {
                    document.getElementById(nodeID).style = 'background-color: #28A4E5';  
                }
                if(grid[i][j].shortestPath == true){
                    document.getElementById(nodeID).style = 'background-color: #ffdf00';    
                }
            }
        }
    }
}
function unHighlight ( ) { nodeID = getid ( this ) ; for ( i = 0 ; i < y ; i ++ ) { for ( j = 0 ; j < x ; j ++ ) { if ( grid [ i ] [ j ] . id === nodeID ) { if ( grid [ i ] [ j ] . start == false && grid [ i ] [ j ] . end == false && grid [ i ] [ j ] . wall == false ) { document . getElementById ( nodeID ) . style = 'background-color: f0f0f0' ; } if ( grid [ i ] [ j ] . animated == true ) { document . getElementById ( nodeID ) . style = 'background-color: #28A4E5' ; } if ( grid [ i ] [ j ] . shortestPath == true ) { document . getElementById ( nodeID ) . style = 'background-color: #ffdf00' ; } } } } }
Return to original colour when mouse leaves
Return to original colour when mouse leaves
//node won't un-highlight if it has been set as start/end/wall node
 //visited nodes that have been animated turn back to green
 //nodes in the shortest path that have been animated turn back to yellow
