<commit_before>iD.svg.Areas = function(projection) {
    return function drawAreas(surface, graph, entities, filter) {
        var areas = [];

        for (var i = 0; i < entities.length; i++) {
            var entity = entities[i];
            if (entity.geometry(graph) === 'area') {
                var points = graph.childNodes(entity).map(function(n) {
                    return projection(n.loc);
                });

                areas.push({
                    entity: entity,
                    area: entity.isDegenerate() ? 0 : d3.geom.polygon(points).area()
                });
            }
        }

        areas.sort(function(a, b) { return a.area - b.area; });

        var lineString = iD.svg.LineString(projection, graph);

        function drawPaths(group, areas, filter, classes) {
            var paths = group.selectAll('path.area')
                .filter(filter)
                .data(areas, iD.Entity.key);

            paths.enter()
                .append('path')
                .attr('class', classes);

            paths<commit_msg>Fix area order. Algorithm is direction sensitive<commit_after>iD.svg.Areas = function(projection) {
    return function drawAreas(surface, graph, entities, filter) {
        var areas = [];

        for (var i = 0; i < entities.length; i++) {
            var entity = entities[i];
            if (entity.geometry(graph) === 'area') {
                var points = graph.childNodes(entity).map(function(n) {
                    return projection(n.loc);
                });

                areas.push({
                    entity: entity,
                    area: entity.isDegenerate() ? 0 : Math.abs(d3.geom.polygon(points).area())
                });
            }
        }

        areas.sort(function(a, b) { return b.area - a.area; });

        var lineString = iD.svg.LineString(projection, graph);

        function drawPaths(group, areas, filter, classes) {
            var paths = group.selectAll('path.area')
                .filter(filter)
                .data(areas, iD.Entity.key);

            paths.enter()
                .append('path')
                .attr('class', classes);

            paths
{'fraction_non_alphanumeric': 0.1308924485125858, 'fraction_numerical': 0.002745995423340961, 'mean_word_length': 1.5155350978135789, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5729474', 'n_tokens_mistral': 623, 'n_tokens_neox': 583, 'n_words': 125}