function drop(ev)
{
    //Determine the position of workspace to avoid dropped elements misalignment.
    var workspace_pos = getElementPosition(document.getElementById("workspace"));
    var workspaceX = workspace_pos.left;
    var workspaceY = workspace_pos.top;
    var dropped_courses;

    //Stop any default
    ev.preventDefault();
    //Get data transfered when the course is dropped in the drop space
    var data = ev.dataTransfer.getData("Text");
    //Append data to the new div
    ev.target.appendChild(document.getElementById(data));
    //Position the element in the drop space
    document.getElementById(data).style.position = "absolute";
    document.getElementById(data).style.left = (ev.clientX - diffX - workspaceX) + "px";
    document.getElementById(data).style.top = (ev.clientY - diffY - workspaceY) + "px";
    document.getElementById(data).style.backgroundColor = "#002244";
    //Clear previous modifications inside the canvas
    clearCanvas();
    //Get all the courses dropped in drop space
    dropped_courses = getDroppedCourses();
    //Prepare courses to be joined by lines to its corresponding prerequisite
    joinCourses(dropped_courses);
    highlightAvailablePrereqs(document.getElementById(data).getAttribute("id"));
    //Prevent propagation of the event
    ev.stopPropagation();
}
//The event handler function for dropping the courses.
The event handler function for dropping the courses.
The event handler function for dropping the courses .
function drop(ev)
{
    var workspace_pos = getElementPosition(document.getElementById("workspace"));
    var workspaceX = workspace_pos.left;
    var workspaceY = workspace_pos.top;
    var dropped_courses;
    ev.preventDefault();
    var data = ev.dataTransfer.getData("Text");
    ev.target.appendChild(document.getElementById(data));
    document.getElementById(data).style.position = "absolute";
    document.getElementById(data).style.left = (ev.clientX - diffX - workspaceX) + "px";
    document.getElementById(data).style.top = (ev.clientY - diffY - workspaceY) + "px";
    document.getElementById(data).style.backgroundColor = "#002244";
    clearCanvas();
    dropped_courses = getDroppedCourses();
    joinCourses(dropped_courses);
    highlightAvailablePrereqs(document.getElementById(data).getAttribute("id"));
    ev.stopPropagation();
}
function drop ( ev ) { var workspace_pos = getElementPosition ( document . getElementById ( "workspace" ) ) ; var workspaceX = workspace_pos . left ; var workspaceY = workspace_pos . top ; var dropped_courses ; ev . preventDefault ( ) ; var data = ev . dataTransfer . getData ( "Text" ) ; ev . target . appendChild ( document . getElementById ( data ) ) ; document . getElementById ( data ) . style . position = "absolute" ; document . getElementById ( data ) . style . left = ( ev . clientX - diffX - workspaceX ) + "px" ; document . getElementById ( data ) . style . top = ( ev . clientY - diffY - workspaceY ) + "px" ; document . getElementById ( data ) . style . backgroundColor = "#002244" ; clearCanvas ( ) ; dropped_courses = getDroppedCourses ( ) ; joinCourses ( dropped_courses ) ; highlightAvailablePrereqs ( document . getElementById ( data ) . getAttribute ( "id" ) ) ; ev . stopPropagation ( ) ; }
The event handler function for dropping the courses.
The event handler function for dropping the courses .
//Determine the position of workspace to avoid dropped elements misalignment. //Stop any default //Get data transfered when the course is dropped in the drop space //Append data to the new div //Position the element in the drop space //Clear previous modifications inside the canvas //Get all the courses dropped in drop space //Prepare courses to be joined by lines to its corresponding prerequisite //Prevent propagation of the event