<commit_before>/* jshint undef: true, unused: true */
/* global L */

import Ember from 'ember';
import ENV from 'bus-detective/config/environment';

export default Ember.Component.extend({
  map: null,
  lat: null,
  lng: null,
  zoom: null,
  zoomControl: false,

  didInsertElement: function() {
    this._configureMap();
  },

  willRemoveElement: function() {
    var map = this.get('map');
    if (map) { map.remove(); }
  },

  _configureMap: function() {
    var el = this.get('element');
    var map = L.map(el, { zoomControl: this.get('zoomControl') });
    var center = [this.get('lat'), this.get('lng')];
    var zoom = this.get('zoom');

    this.set('map', map);
    map.setView(center, zoom);

    L.Icon.Default.imagePath = `//${ENV.cdnHost}/assets/images`;
    L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>'
    }).addTo(map);

    L.marker(center).addTo(map);
  }
});<commit_msg>Use retina map tiles<commit_after>/* jshint undef: true, unused: true */
/* global L */

import Ember from 'ember';
import ENV from 'bus-detective/config/environment';

export default Ember.Component.extend({
  map: null,
  lat: null,
  lng: null,
  zoom: null,
  zoomControl: false,

  didInsertElement: function() {
    this._configureMap();
  },

  willRemoveElement: function() {
    var map = this.get('map');
    if (map) { map.remove(); }
  },

  _configureMap: function() {
    var el = this.get('element');
    var map = L.map(el, { zoomControl: this.get('zoomControl') });
    var center = [this.get('lat'), this.get('lng')];
    var zoom = this.get('zoom');

    this.set('map', map);
    map.setView(center, zoom);

    L.Icon.Default.imagePath = `//${ENV.cdnHost}/assets/images`;
    L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Tiles courtesy of <a href="http://hot.openstreetmap.org/" target="_blank">Humanitarian OpenStreetMap Team</a>',
      detectRetina: true
    }).addTo(map);

    L.marker(center).addTo(map);
  }
});
{'fraction_non_alphanumeric': 0.19876288659793814, 'fraction_numerical': 0.0016494845360824743, 'mean_word_length': 3.6833976833976836, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3915162', 'n_tokens_mistral': 874, 'n_tokens_neox': 839, 'n_words': 167}