function drawLine(course1, course2) {
    //Get the position of the workspace and courses in the drop space to avoid misalignment
    var workspace_pos = getElementPosition(document.getElementById("workspace"));
    var workspaceX = workspace_pos.left;
    var workspaceY = workspace_pos.top;
    var course1_pos = getElementPosition(document.getElementById(course1));
    var course2_pos = getElementPosition(document.getElementById(course2));
    //Get the width of each course container to center connection of thedrawed lines
    var course1_width = document.getElementById(course1).offsetWidth;
    var course2_width = document.getElementById(course2).offsetWidth;
    //Get canvas
    var canvas = document.getElementById("canvas");
    if (canvas.getContext) {
        //Get canvas context
        var ctx = canvas.getContext("2d");
        //Lines styles
        ctx.fillStyle = "red";
        ctx.strokeStyle = "red";
        //Set line starting point
        ctx.moveTo(course1_pos.left - workspaceX + course1_width / 2, course1_pos.top - workspaceY);
        //Draw circular arrow
        ctx.arc(course1_pos.left - workspaceX + course1_width / 2, course1_pos.top - workspaceY, 5, 0, 2 * Math.PI);
        //Set line end point
        ctx.lineTo(course2_pos.left - workspaceX + course2_width / 2, course2_pos.top - workspaceY);
        //Draw line
        ctx.fill();
        ctx.stroke();
    }
}
//Function to draw a line that will join every course with its respective prerequisites
Function to draw a line that will join every course with its respective prerequisites
Function to draw a line that will join every course with its respective prerequisites
function drawLine(course1, course2) {
    var workspace_pos = getElementPosition(document.getElementById("workspace"));
    var workspaceX = workspace_pos.left;
    var workspaceY = workspace_pos.top;
    var course1_pos = getElementPosition(document.getElementById(course1));
    var course2_pos = getElementPosition(document.getElementById(course2));
    var course1_width = document.getElementById(course1).offsetWidth;
    var course2_width = document.getElementById(course2).offsetWidth;
    var canvas = document.getElementById("canvas");
    if (canvas.getContext) {
         context
        var ctx = canvas.getContext("2d");
        ctx.fillStyle = "red";
        ctx.strokeStyle = "red";
        ctx.moveTo(course1_pos.left - workspaceX + course1_width / 2, course1_pos.top - workspaceY);
        ctx.arc(course1_pos.left - workspaceX + course1_width / 2, course1_pos.top - workspaceY, 5, 0, 2 * Math.PI);
        ctx.lineTo(course2_pos.left - workspaceX + course2_width / 2, course2_pos.top - workspaceY);
        ctx.fill();
        ctx.stroke();
    }
}
function drawLine ( course1 , course2 ) { var workspace_pos = getElementPosition ( document . getElementById ( "workspace" ) ) ; var workspaceX = workspace_pos . left ; var workspaceY = workspace_pos . top ; var course1_pos = getElementPosition ( document . getElementById ( course1 ) ) ; var course2_pos = getElementPosition ( document . getElementById ( course2 ) ) ; var course1_width = document . getElementById ( course1 ) . offsetWidth ; var course2_width = document . getElementById ( course2 ) . offsetWidth ; var canvas = document . getElementById ( "canvas" ) ; if ( canvas . getContext ) { var ctx = canvas . getContext ( "2d" ) ; ctx . fillStyle = "red" ; ctx . strokeStyle = "red" ; ctx . moveTo ( course1_pos . left - workspaceX + course1_width / 2 , course1_pos . top - workspaceY ) ; ctx . arc ( course1_pos . left - workspaceX + course1_width / 2 , course1_pos . top - workspaceY , 5 , 0 , 2 * Math . PI ) ; ctx . lineTo ( course2_pos . left - workspaceX + course2_width / 2 , course2_pos . top - workspaceY ) ; ctx . fill ( ) ; ctx . stroke ( ) ; } }
Function to draw a line that will join every course with its respective prerequisites
Function to draw a line that will join every course with its respective prerequisites
//Get the position of the workspace and courses in the drop space to avoid misalignment //Get the width of each course container to center connection of thedrawed lines //Get canvas //Get canvas context //Lines styles //Set line starting point //Draw circular arrow //Set line end point //Draw line