<commit_before>Raphael.fn.arrow = function (x1, y1, x2, y2, size, n) {
    //Arrowhead
    var angle = Math.atan2(x1-x2,y2-y1);
    angle = (angle / (2 * Math.PI)) * 360;
    var arrowPath = this.path("M" + x2 + " " + y2 + " L" + (x2  - size) + " " + (y2  - size) + " L" + (x2  - size)  + " " + (y2  + size) + " L" + x2 + " " + y2 ).attr("fill","black").transform("R" + (90+angle));
    arrowPath.id = "arrowHead" + n;
    //Line
    var linePath = this.path("M" + x1 + " " + y1 + " L" + x2 + " " + y2);
    linePath.id = "arrowLine" + n;
    return [linePath, arrowPath];
};

updateArrow = function(x2, y2, size, n) {
    var arrowLinePath = paper.getById('arrowLine' + n).attr("path");
    var x1 = arrowLinePath[0][1];
    var y1 = arrowLinePath[0][2];
    //Arrowhead
    var angle = Math.atan2(x1-x2,y2-y1);
    angle = (angle / (2 * Math.PI)) * 360;
    //Line
    var linePath = "M" + x1 + " " + y1 + " L" + x2 + " " + y2;
    var arrowPath = "M" + x2 + " " + y2 + " L" + (x2  - size) + " " + (y2  - size) + " L" + (x2  - size)  + " " + (y2  + size) + " L" + x2 + " " + y2;
    console.log();
    paper.getById('arrowLine' + n).attr({path: linePath});
    paper.getById('arrowHead' + n).attr({path: arrowPath}).transform("r" + (90+angle));
}

$(document).ready(function() {
    paper = new Raphael("raphael",2000, 2000);
    arr = false;
    m = 1;
    currArrow = [];
});

test = function() {
    html =  "<div class='box'>" +
            "   <div class='lBox'></div>" +
            "   <div class='rBox'></div>" +
            "</div>";
    movie = $('#movie')[0];
    movie.innerHTML += html;
    initialize();
};

initialize = function() {
    rBoxen = $('.rBox');
    rBoxen.bind('click', dragStart);
    lBoxen = $('.lBox');
    lBoxen.bind('click', drop);
}

dragStart = function(/* Event */ e) {
    var elem = $(e.target);
    var off = elem.offset();
    startX = off.left + elem.width();
    startY = off.top + elem.height()/2;
    if(!elem[0].id)
    {
        elem[0].id = m;
        currArrow.push(-m);
        m++;
    }
    else
    {
       currArrow.push(elem[0].id); 
    }
    $(document).mousemove(function(e) {
        for (var i in currArrow) {
            if(currArrow[i] > 0)
            {
                updateArrow(e.pageX,e.pageY, 8, currArrow[i]);
            }
            else
            {
                currArrow[i] = -1 * currArrow[i];
                arr = paper.arrow(startX,startY,e.pageX,e.pageY,8, currArrow[i]);
            }
        }
    });
}

drop = function(/* Event */ e) {
    $(document).off('mousemove');
    currArrow = [];
}<commit_msg>boxes move, lines don't follow<commit_after>Raphael.fn.arrow = function (x1, y1, x2, y2, size, n) {
    //Arrowhead
    var angle = Math.atan2(x1-x2,y2-y1);
    angle = (angle / (2 * Math.PI)) * 360;
    var arrowPath = this.path("M" + x2 + " " + y2 + " L" + (x2  - size) + " " + (y2  - size) + " L" + (x2  - size)  + " " + (y2  + size) + " L" + x2 + " " + y2 ).attr("fill","black").transform("R" + (90+angle));
    arrowPath.id = "arrowHead" + n;
    //Line
    var linePath = this.path("M" + x1 + " " + y1 + " L" + x2 + " " + y2);
    linePath.id = "arrowLine" + n;
    return [linePath, arrowPath];
};

updateArrow = function(x2, y2, size, n) {
    var arrowLinePath = paper.getById('arrowLine' + n).attr("path");
    var x1 = arrowLinePath[0][1];
    var y1 = arrowLinePath[0][2];
    //Arrowhead
    var angle = Math.atan2(x1-x2,y2-y1);
    angle = (angle / (2 * Math.PI)) * 360;
    //Line
    var linePath = "M" + x1 + " " + y1 + " L" + x2 + " " + y2;
    var arrowPath = "M" + x2 + " " + y2 + " L" + (x2  - size) + " " + (y2  - size) + " L" + (x2  - size)  + " " + (y2  + size) + " L" + x2 + " " + y2;
    console.log();
    paper.getById('arrowLine' + n).attr({path: linePath});
    paper.getById('arrowHead' + n).attr({path: arrowPath}).transform("r" + (90+angle));
}

$(document).ready(function() {
    paper = new Raphael("raphael",2000, 2000);
    arr = false;
    m = 1;
    currArrow = [];
});

test = function() {
    html =  "<div class='box'>" +
            "   <div class='lBox'></div>" +
            "   <div class='rBox'></div>" +
            "</div>";
    movie = $('#movie')[0];
    movie.innerHTML += html;
    initialize();
};

initialize = function() {
    rBoxen = $('.rBox');
    rBoxen.bind('click', dragStart);
    lBoxen = $('.lBox');
    lBoxen.bind('click', drop);
    boxen = $('.box');
    boxen.bind('click', moveBox);
}

moveBox = function(/* Event */ e) {
    var elem = $(e.target);
    $(document).on('mousemove', function(e) {
        var x = elem.width()/2;
        var y = elem.height()/2;
        elem.offset({left: e.pageX-x, top: e.pageY-y});
    });
    elem.bind('click', stopBox);
}

stopBox = function(/* Event */ e) {
    var elem = $(e.target);
    $(document).off('mousemove');
    elem.bind('click', moveBox);
}

dragStart = function(/* Event */ e) {
    e.stopPropagation();
    var elem = $(e.target);
    var off = elem.offset();
    startX = off.left + elem.width();
    startY = off.top + elem.height()/2;
    if(!elem[0].id)
    {
        elem[0].id = m;
        currArrow.push(-m);
        m++;
    }
    else
    {
       currArrow.push(elem[0].id); 
    }
    $(document).mousemove(function(e) {
        for (var i in currArrow) {
            if(currArrow[i] > 0)
            {
                updateArrow(e.pageX,e.pageY, 8, currArrow[i]);
            }
            else
            {
                currArrow[i] = -1 * currArrow[i];
                arr = paper.arrow(startX,startY,e.pageX,e.pageY,8, currArrow[i]);
            }
        }
    });
}

drop = function(/* Event */ e) {
    e.stopPropagation();
    $(document).off('mousemove');
    currArrow = [];
}
{'fraction_non_alphanumeric': 0.21606986899563319, 'fraction_numerical': 0.026899563318777294, 'mean_word_length': 2.0818083961248655, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2310777', 'n_tokens_mistral': 2243, 'n_tokens_neox': 2227, 'n_words': 433}