<commit_before>angular
  .module('mapcache')
  .directive('leafletCache', leafletCache);

function leafletCache() {
  var directive = {
    restrict: "A",
    replace: true,
    template: '<div style="height: 500px;"></div>',
    scope: {
      cache: '=',
      options: '='
    },
    controller: LeafletCacheController
  };

  return directive;
}

LeafletCacheController.$inject = ['$scope', '$element', 'LocalStorageService', 'CacheService', 'LeafletUtilities'];

function LeafletCacheController($scope, $element, LocalStorageService, CacheService, LeafletUtilities) {

  var baseLayerOptions = $scope.options || {
    maxZoom: 18,
    tms: false,
    opacity: 1
  };

  var cacheLayerOptions = {
    maxZoom: 18,
    tms: false,
    opacity: 1
  };
  var map = null;

  var defaultLayer = baseLayerOptions.baseLayerUrl;

  var baseLayer = L.tileLayer(defaultLayer, baseLayerOptions);
  var cacheLayer = null;

  $scope.$watch('cache', function(cache, oldCache) {
    if (oldCache && oldCache.status.complete) return;
    if (cache == oldCache) return;
    if (!cache.status.complete) return;
    map = L.map($element[0], {
      center: [45,0],
      zoom: 3,
      minZoom: cache.source.vector ? 0 : cache.minZoom,
      maxZoom: cache.source.vector ? 18 : cache.maxZoom
    });
    map.addControl(new L.Control.ZoomIndicator());

    baseLayer.addTo(map);
    cacheLayerOptions.tms = 'tms' == cache.source.format;
    cacheLayerOptions.maxZoom = cache.source.vector ? 18 : cache.maxZoom;
    cacheLayerOptions.minZoom = cache.source.vector ? 0 : cache.minZoom;
    if (cacheLayer) {
      map.removeLayer(cacheLayer);
    }
    cacheLayer = LeafletUtilities.tileLayer(cache, defaultLayer, cacheLayerOptions, cache.style, styleFunction);
    if (cacheLayer) {
      cacheLayer.addTo(map);<commit_msg>increase opacity to 1 if it is a vector cache<commit_after>angular
  .module('mapcache')
  .directive('leafletCache', leafletCache);

function leafletCache() {
  var directive = {
    restrict: "A",
    replace: true,
    template: '<div style="height: 500px;"></div>',
    scope: {
      cache: '=',
      options: '='
    },
    controller: LeafletCacheController
  };

  return directive;
}

LeafletCacheController.$inject = ['$scope', '$element', 'LocalStorageService', 'CacheService', 'LeafletUtilities'];

function LeafletCacheController($scope, $element, LocalStorageService, CacheService, LeafletUtilities) {

  var baseLayerOptions = $scope.options || {
    maxZoom: 18,
    tms: false,
    opacity: 1
  };

  var cacheLayerOptions = {
    maxZoom: 18,
    tms: false,
    opacity: 1
  };
  var map = null;

  var defaultLayer = baseLayerOptions.baseLayerUrl;

  var baseLayer = L.tileLayer(defaultLayer, baseLayerOptions);
  var cacheLayer = null;

  $scope.$watch('cache', function(cache, oldCache) {
    if (oldCache && oldCache.status.complete) return;
    if (cache == oldCache) return;
    if (!cache.status.complete) return;
    map = L.map($element[0], {
      center: [45,0],
      zoom: 3,
      minZoom: cache.source.vector ? 0 : cache.minZoom,
      maxZoom: cache.source.vector ? 18 : cache.maxZoom
    });
    map.addControl(new L.Control.ZoomIndicator());
    if (cache.vector) {
      baseLayer.setOpacity(1);
    }

    baseLayer.addTo(map);
    cacheLayerOptions.tms = 'tms' == cache.source.format;
    cacheLayerOptions.maxZoom = cache.source.vector ? 18 : cache.maxZoom;
    cacheLayerOptions.minZoom = cache.source.vector ? 0 : cache.minZoom;
    if (cacheLayer) {
      map.removeLayer(cacheLayer);
    }
    cacheLayer = LeafletUtilities.tileLayer(cache, defaultLayer, cacheLayerOptions, cache.style, styleFunction);
    if (cacheLayer) {
      cacheLayer.addTo(map);
{'fraction_non_alphanumeric': 0.13522267206477734, 'fraction_numerical': 0.011336032388663968, 'mean_word_length': 3.569667077681874, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7482340', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1165, 'n_words': 249}