<commit_before>(function () {
'use strict';

  angular.module('hutmap.controllers').

  /*
   * This controller does configuration of the google map, as well as provides
   * functions which aren't really 'clean' enough to be in MapCtrl, i.e.
   * involve dom manipulation or calling into google.maps.
   */
  controller('MapConfigCtrl', 
    
    ['$scope', '$http', 'hutmapMapId', 'mapOptions',
    'markerOptions',

    function ($scope, $http, hutmapMapId, mapOptions,
      markerOptions) {

    var prevSelectedMarker;
    var prevIcon;

    $scope.mc = {
      hutmapMapId: hutmapMapId,
      mapOptions: mapOptions.main
    };

    // return proper google.maps.MapOptions for the given hut
    $scope.getMarkerOptions = function(hut) {
      var opts = {};
      if ($scope.h.filteredHuts && hut.id in $scope.h.filteredHutIds) {
        return angular.extend(opts, markerOptions.filteredHuts);
      } else {
        return angular.extend(opts, markerOptions.huts);
      }
    };

    // called when marker is clicked or hut is otherwise selected
    $scope.selectHut = function(marker, hut) {
      if (prevSelectedMarker) {
        var opts = angular.extend({}, markerOptions.huts, {icon: prevIcon});
        prevSelectedMarker.setOptions(opts);
      }
      prevSelectedMarker = marker;
      prevIcon = marker.getIcon();
      marker.setOptions(markerOptions.selected);
      $scope.h.selectedHut = hut;
    };
  }]);
})();<commit_msg>Don't unselect hut when map dragged.<commit_after>(function () {
'use strict';

  angular.module('hutmap.controllers').

  /*
   * This controller does configuration of the google map, as well as provides
   * functions which aren't really 'clean' enough to be in MapCtrl, i.e.
   * involve dom manipulation or calling into google.maps.
   */
  controller('MapConfigCtrl', 
    
    ['$scope', '$http', 'hutmapMapId', 'mapOptions',
    'markerOptions',

    function ($scope, $http, hutmapMapId, mapOptions,
      markerOptions) {

    var prevSelectedMarker;
    var prevIcon;

    $scope.mc = {
      hutmapMapId: hutmapMapId,
      mapOptions: mapOptions.main
    };

    // return proper google.maps.MapOptions for the given hut
    $scope.getMarkerOptions = function(hut) {
      var opts = {};

      if ($scope.h.filteredHuts && hut.id in $scope.h.filteredHutIds) {
        opts = angular.extend(opts, markerOptions.filteredHuts);
      } else {
        opts = angular.extend(opts, markerOptions.huts);
      }

      if ($scope.h.selectedHut && $scope.h.selectedHut.id === hut.id) {
        opts = angular.extend(opts, markerOptions.selected);
      }

      return opts;
    };

    $scope.unselectHut = function() {
      if (prevSelectedMarker) {
        var opts = angular.extend({}, markerOptions.huts, {icon: prevIcon});
        prevSelectedMarker.setOptions(opts);
      }
      $scope.h.selectedHut = null;
    }

    // called when marker is clicked or hut is otherwise selected
    $scope.selectHut = function(marker, hut) {
      $scope.unselectHut();
      prevSelectedMarker = marker;
      prevIcon = marker.getIcon();
      marker.setOptions(markerOptions.selected);
      $scope.h.selectedHut = hut;
    };
  }]);
})();
{'fraction_non_alphanumeric': 0.12531328320802004, 'fraction_numerical': 0.0, 'mean_word_length': 2.819377990430622, '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': '2560256', 'n_tokens_mistral': 993, 'n_tokens_neox': 945, 'n_words': 233}