<commit_before>iD.Map = function(context) {
    var dimensions = [1, 1],
        dispatch = d3.dispatch('move', 'drawn'),
        projection = d3.geo.mercator().scale(512 / Math.PI),
        roundedProjection = iD.svg.RoundProjection(projection),
        zoom = d3.behavior.zoom()
            .translate(projection.translate())
            .scale(projection.scale() * 2 * Math.PI)
            .scaleExtent([1024, 256 * Math.pow(2, 24)])
            .on('zoom', zoomPan),
        dblclickEnabled = true,
        transformStart,
        minzoom = 0,
        layers = [
            iD.Background().projection(projection),
            iD.LocalGpx(context).projection(projection),
            iD.Background('overlay').projection(projection)
            ],
        transformProp = iD.util.prefixCSSProperty('Transform'),
        points = iD.svg.Points(roundedProjection, context),
        vertices = iD.svg.Vertices(roundedProjection, context),
        lines = iD.svg.Lines(projection),
        areas = iD.svg.Areas(roundedProjection),
        midpoints = iD.svg.Midpoints(roundedProjection, context),
        labels = iD.svg.Labels(roundedProjection, context),
        tail = iD.ui.Tail(),
        surface, layergroup;

    function map(selection) {
        context.history()
            .on('change.map', redraw);

        context.on('select.map', function() {
            redraw();
        });

        selection.call(zoom);

        layergroup = selection.append('div')
            .attr('id', 'layer-g');

        var supersurface = selection.append('div')
            .style('position', 'absolute');

        surface = supersurface.append('svg')
            .on('mousedown.zoom', function() {
                if (d3.event.button == 2) {
                    d3.event.stopPropagation();
                }
            }, true)
            .on('mouseup.zoom', function() {
                if (resetTransform()) redraw();
            })
            .attr('id', 'surface')
            .call(iD.svg.Surface(context));

        surface.on('mouseover.vertices', function() {
            vertices.hover(d3.event.target.__data__);
            if (!isTransformed()) surface.call(vertices, context.graph(), map.zoom());
        });

        surface.on('mouseout.vertices', function() {
            vertices.hover(d3.event.relatedTarget && d3.event.relatedTarget.__data__);
            if (!isTransformed()) surface.call(vertices, context.graph(), map.zoom());
        });

        map.size(selection.size());
        map.surface = surface;
        map.layersurface = layergroup;

        labels.supersurface(supersurface);

        supersurface
            .call(tail);
    }

    function pxCenter() { return [dimensions[0] / 2, dimensions[1] / 2]; }

    function drawVector(difference) {
        var filter, all,
            extent = map.extent(),
            graph = context.graph();

        if (!difference) {
            all = context.intersects(extent);
            filter = d3.functor(true);
        } else {
            var complete = difference.complete(extent);
            all = _.compact(_.values(complete));
            filter = function(d) {
                if (d.type === 'midpoint') {

                    var a = d.edge[0],
                        b = d.edge[1];<commit_msg>Don't draw when not editable<commit_after>iD.Map = function(context) {
    var dimensions = [1, 1],
        dispatch = d3.dispatch('move', 'drawn'),
        projection = d3.geo.mercator().scale(512 / Math.PI),
        roundedProjection = iD.svg.RoundProjection(projection),
        zoom = d3.behavior.zoom()
            .translate(projection.translate())
            .scale(projection.scale() * 2 * Math.PI)
            .scaleExtent([1024, 256 * Math.pow(2, 24)])
            .on('zoom', zoomPan),
        dblclickEnabled = true,
        transformStart,
        minzoom = 0,
        layers = [
            iD.Background().projection(projection),
            iD.LocalGpx(context).projection(projection),
            iD.Background('overlay').projection(projection)
            ],
        transformProp = iD.util.prefixCSSProperty('Transform'),
        points = iD.svg.Points(roundedProjection, context),
        vertices = iD.svg.Vertices(roundedProjection, context),
        lines = iD.svg.Lines(projection),
        areas = iD.svg.Areas(roundedProjection),
        midpoints = iD.svg.Midpoints(roundedProjection, context),
        labels = iD.svg.Labels(roundedProjection, context),
        tail = iD.ui.Tail(),
        surface, layergroup;

    function map(selection) {
        context.history()
            .on('change.map', redraw);

        context.on('select.map', function() {
            redraw();
        });

        selection.call(zoom);

        layergroup = selection.append('div')
            .attr('id', 'layer-g');

        var supersurface = selection.append('div')
            .style('position', 'absolute');

        surface = supersurface.append('svg')
            .on('mousedown.zoom', function() {
                if (d3.event.button == 2) {
                    d3.event.stopPropagation();
                }
            }, true)
            .on('mouseup.zoom', function() {
                if (resetTransform()) redraw();
            })
            .attr('id', 'surface')
            .call(iD.svg.Surface(context));

        surface.on('mouseover.vertices', function() {
            vertices.hover(d3.event.target.__data__);
            if (map.editable() && !isTransformed()) {
                surface.call(vertices, context.graph(), map.zoom());
            }
        });

        surface.on('mouseout.vertices', function() {
            vertices.hover(d3.event.relatedTarget && d3.event.relatedTarget.__data__);
            if (map.editable() && !isTransformed()) {
                surface.call(vertices, context.graph(), map.zoom());
            }
        });

        map.size(selection.size());
        map.surface = surface;
        map.layersurface = layergroup;

        labels.supersurface(supersurface);

        supersurface
            .call(tail);
    }

    function pxCenter() { return [dimensions[0] / 2, dimensions[1] / 2]; }

    function drawVector(difference) {
        var filter, all,
            extent = map.extent(),
            graph = context.graph();

        if (!difference) {
            all = context.intersects(extent);
            filter = d3.functor(true);
        } else {
            var complete = difference.complete(extent);
            all = _.compact(_.values(complete));
            filter = function(d) {
                if (d.type === 'midpoint') {

                    var a = d.edge[0],
                        b = d.edge[1];
{'fraction_non_alphanumeric': 0.1439700374531835, 'fraction_numerical': 0.009887640449438202, 'mean_word_length': 1.8566538296961916, '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': '4472973', 'n_tokens_mistral': 1958, 'n_tokens_neox': 1860, 'n_words': 315}