pathfinder/src/controls.js
//Making seperate function for setting walls to allow for click and drag (this used to be part of set state before adding click and drag functionality)

Making seperate function for setting walls to allow for click and drag (this used to be part of set state before adding click and drag functionality)
Making seperate function for setting walls to allow for click and drag ( this used to be part of set state before adding click and drag functionality )
function wallOn() {
    nodeID = getid(this);
    if(cursor.wall == true) {
        cursor.mouseClickedDown = true;
        document.getElementById(nodeID).style = 'background-color: black';
        for(i=0; i<y; i++){
            for(j=0; j<x; j++){
                if (grid[i][j].id === nodeID){
                    grid[i][j].start = false;
                    grid[i][j].end = false;
                    grid[i][j].wall = true;
                }
            }
        }
    }
    if(cursor.eraseWall == true) {              
        cursor.mouseClickedDown = true;
        document.getElementById(nodeID).style = 'background-color: #f0f0f0';
        for(i=0; i<y; i++){
            for(j=0; j<x; j++){
                if (grid[i][j].id === nodeID){
                    grid[i][j].wall = false;
                }
            }
        }
    }
}
function wallOn ( ) { nodeID = getid ( this ) ; if ( cursor . wall == true ) { cursor . mouseClickedDown = true ; document . getElementById ( nodeID ) . style = 'background-color: black' ; for ( i = 0 ; i < y ; i ++ ) { for ( j = 0 ; j < x ; j ++ ) { if ( grid [ i ] [ j ] . id === nodeID ) { grid [ i ] [ j ] . start = false ; grid [ i ] [ j ] . end = false ; grid [ i ] [ j ] . wall = true ; } } } } if ( cursor . eraseWall == true ) { cursor . mouseClickedDown = true ; document . getElementById ( nodeID ) . style = 'background-color: #f0f0f0' ; for ( i = 0 ; i < y ; i ++ ) { for ( j = 0 ; j < x ; j ++ ) { if ( grid [ i ] [ j ] . id === nodeID ) { grid [ i ] [ j ] . wall = false ; } } } } }
Making seperate function for setting walls to allow for click and drag (this used to be part of set state before adding click and drag functionality)
Making seperate function for setting walls to allow for click and drag ( this used to be part of set state before adding click and drag functionality )
// document.getElementById(nodeID).class = 'wall';
 //Intergrating erase wall functions as well...
 // document.getElementById(nodeID).class = 'wall';
