<commit_before>iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
    var way = context.entity(wayId),
        finished = false,
        annotation = t((way.isDegenerate() ?
            'operations.start.annotation.' :
            'operations.continue.annotation.') + context.geometry(wayId)),
        draw = iD.behavior.Draw(context);

    var node = iD.Node({loc: context.map().mouseCoordinates()}),
        nodeId = node.id;

    context[way.isDegenerate() ? 'replace' : 'perform'](
        iD.actions.AddEntity(node),
        iD.actions.AddVertex(wayId, node.id, index));

    function move(datum) {
        var loc = context.map().mouseCoordinates();

        if (datum.type === 'node' || datum.type === 'midpoint') {
            loc = datum.loc;
        } else if (datum.type === 'way') {
            loc = iD.geo.chooseIndex(datum, d3.mouse(context.surface().node()), context).loc;
        }

        context.replace(iD.actions.MoveNode(nodeId, loc));<commit_msg>Don't snap to midpoints, snap to their parent way<commit_after>iD.behavior.DrawWay = function(context, wayId, index, mode, baseGraph) {
    var way = context.entity(wayId),
        finished = false,
        annotation = t((way.isDegenerate() ?
            'operations.start.annotation.' :
            'operations.continue.annotation.') + context.geometry(wayId)),
        draw = iD.behavior.Draw(context);

    var node = iD.Node({loc: context.map().mouseCoordinates()}),
        nodeId = node.id;

    context[way.isDegenerate() ? 'replace' : 'perform'](
        iD.actions.AddEntity(node),
        iD.actions.AddVertex(wayId, node.id, index));

    function move(datum) {
        var loc = context.map().mouseCoordinates();

        if (datum.type === 'node') {
            loc = datum.loc;
        } else if (datum.type === 'midpoint' || datum.type === 'way') {
            var way = datum.type === 'way' ?
                datum :
                baseGraph.entity(datum.ways[0].id);
            loc = iD.geo.chooseIndex(way, d3.mouse(context.surface().node()), context).loc;
        }

        context.replace(iD.actions.MoveNode(nodeId, loc));
{'fraction_non_alphanumeric': 0.16129032258064516, 'fraction_numerical': 0.001402524544179523, 'mean_word_length': 2.502454991816694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5688002', 'n_tokens_mistral': 685, 'n_tokens_neox': 657, 'n_words': 119}