<commit_before>var territoryBro = (function () {

  function wktToFeature(wkt) {
    var feature = new ol.format.WKT().readFeature(wkt);
    feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
    return feature;
  }

  function useHighDpiMaps(map) {
    // render at a higher zoom level for high DPI
    var updateSize = map.updateSize;
    map.updateSize = function () {
      updateSize.call(this);
      this.setSize(this.getSize().map(function (x) {
        return x * 2;
      }));
    };
    map.updateSize();
    // XXX: the canvas size resets when the window is resized
    window.addEventListener('resize', function (e) {
      map.updateSize();
    });
  }

  function initTerritoryMap(elementId, territoryWkt) {
    var territoryLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(territoryWkt)]
      }),
      style: new ol.style.Style({
        stroke: new ol.style.Stroke({
          color: 'rgba(255, 0, 0, 1.0)',
          width: 3
        }),
        fill: new ol.style.Fill({
          color: 'rgba(255, 0, 0, 0.1)'
        })
      })
    });

    var streetsLayer = new ol.layer.Tile({
      source: new ol.source.OSM()
    });

    var map = new ol.Map({
      target: elementId,
      pixelRatio: 2, // render at high DPI for printing
      layers: [streetsLayer, territoryLayer],
      controls: [],
      interactions: [],
      view: new ol.View({
        center: ol.proj.fromLonLat([0.0, 0.0]),
        zoom: 1,
        // show more surrounding area for small territories
        maxZoom: 18
      })
    });
    //useHighDpiMaps(map);
    map.getView().fit(territoryLayer.getSource().getExtent(), map.getSize());
  }

  function initTerritoryMiniMap(elementId, territoryWkt, regionWkt) {
    var territoryLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(territoryWkt)]
      }),
      style: new ol.style.Style({
        image: new ol.style.Circle({
          radius: 8,
          fill: new ol.style.Fill({
            color: 'rgba(0, 0, 0, 1.0)'
          })
        })
      })
    });

    var regionLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(regionWkt)]
      }),
      style: new ol.style.Style({
        stroke: new ol.style.Stroke({
          color: 'rgba(0, 0, 0, 1.0)',
          width: 1.5
        })
      })
    });

    var streetsLayer = new ol.layer.Tile({
      source: new ol.source.OSM()
    });

    var map = new ol.Map({
      target: elementId,
      pixelRatio: 2, // render at high DPI for printing
      layers: [/*streetsLayer,*/ regionLayer, territoryLayer],
      controls: [],
      interactions: [],
      view: new ol.View({
        center: ol.proj.fromLonLat([0.0, 0.0]),
        zoom: 1
      })
    });
    useHighDpiMaps(map);
    map.getView().fit(regionLayer.getSource().getExtent(), map.getSize());
  }

  return {
    initTerritoryMap: initTerritoryMap,
    initTerritoryMiniMap: initTerritoryMiniMap
  };
})();<commit_msg>Zoom at smaller steps, show streets layer in minimap<commit_after>var territoryBro = (function () {

  function wktToFeature(wkt) {
    var feature = new ol.format.WKT().readFeature(wkt);
    feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');
    return feature;
  }

  function useHighDpiMaps(map) {
    // render at a higher zoom level for high DPI
    var updateSize = map.updateSize;
    map.updateSize = function () {
      updateSize.call(this);
      this.setSize(this.getSize().map(function (x) {
        return x * 2;
      }));
    };
    map.updateSize();
    // XXX: the canvas size resets when the window is resized
    window.addEventListener('resize', function (e) {
      map.updateSize();
    });
  }

  function initTerritoryMap(elementId, territoryWkt) {
    var territoryLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(territoryWkt)]
      }),
      style: new ol.style.Style({
        stroke: new ol.style.Stroke({
          color: 'rgba(255, 0, 0, 1.0)',
          width: 3
        }),
        fill: new ol.style.Fill({
          color: 'rgba(255, 0, 0, 0.1)'
        })
      })
    });

    var streetsLayer = new ol.layer.Tile({
      source: new ol.source.OSM()
    });

    var map = new ol.Map({
      target: elementId,
      pixelRatio: 2, // render at high DPI for printing
      layers: [streetsLayer, territoryLayer],
      view: new ol.View({
        center: ol.proj.fromLonLat([0.0, 0.0]),
        zoom: 1,
        minResolution: 1.25, // prevent zooming too close, show more surrounding for small territories
        zoomFactor: 1.1 // zoom in small steps to enable fine tuning
      })
    });
    //useHighDpiMaps(map);
    map.getView().fit(
      territoryLayer.getSource().getExtent(),
      map.getSize(),
      {
        padding: [20, 20, 20, 20]
      }
    );
  }

  function initTerritoryMiniMap(elementId, territoryWkt, regionWkt) {
    var territoryLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(territoryWkt)]
      }),
      style: new ol.style.Style({
        image: new ol.style.Circle({
          radius: 3.5,
          fill: new ol.style.Fill({
            color: 'rgba(0, 0, 0, 1.0)'
          })
        })
      })
    });

    var regionLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: [wktToFeature(regionWkt)]
      }),
      style: new ol.style.Style({
        stroke: new ol.style.Stroke({
          color: 'rgba(0, 0, 0, 1.0)',
          width: 2,
          lineDash: [1, 10],
          lineCap: 'round'
        })
      })
    });

    var streetsLayer = new ol.layer.Tile({
      source: new ol.source.OSM()
    });

    var map = new ol.Map({
      target: elementId,
      pixelRatio: 2, // render at high DPI for printing
      layers: [streetsLayer, regionLayer, territoryLayer],
      controls: [],
      interactions: [],
      view: new ol.View({
        center: ol.proj.fromLonLat([0.0, 0.0]),
        zoom: 1
      })
    });
    //useHighDpiMaps(map);
    map.getView().fit(
      regionLayer.getSource().getExtent(),
      map.getSize(),
      {
        padding: [5, 5, 5, 5],
        constrainResolution: false
      }
    );
  }

  return {
    initTerritoryMap: initTerritoryMap,
    initTerritoryMiniMap: initTerritoryMiniMap
  };
})();
{'fraction_non_alphanumeric': 0.14265668849391955, 'fraction_numerical': 0.018709073900841908, 'mean_word_length': 2.13232421875, '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': '633867', 'n_tokens_mistral': 2178, 'n_tokens_neox': 2054, 'n_words': 484}