<commit_before>import React from 'react';

import LoadingSpinner from '../Loading/LoadingSpinner';
import SimpleLegend from './SimpleLegend';


class SimpleMap extends React.Component {
  constructor() {
    super();
    this.state = {
      loading: false
    };
  }

  componentWillMount() {
    this.props.getLayerData(this.props.layerId);
  }

  componentDidMount() {
    this.initMap();
  }

  componentWillReceiveProps(props) {
    const layer = props.data[props.layerId] || false;
    if (layer) {
      this.updateMapPosition(layer);
      this.addMapLayer(layer);
    }
  }

  initMap() {
    const params = {
      zoom: 2,
      lat: 48.46038,
      lng: -123.889823
    };

    this.mapLayers = {};
    this.map = L.map(this.refs.map, {
      zoomControl: false,
      center: [+params.lat, +params.lng],
      zoom: +params.zoom,
      minZoom: 2
    });

    L.tileLayer(
      'http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png',
      { maxZoom: 18 }
    ).addTo(this.map, 1);
  }

  updateMapPosition(layer) {
    const center = layer.attributes['layer-config'].center;
    const zoom = layer.attributes['layer-config'].zoom;
    if (center && center.lat && center.lng && zoom) {
      this.map.setView(new L.LatLng(center.lat, center.lng), zoom);
    }
  }

  addMapLayer(layer) {
    if (!this.state.loading) {<commit_msg>disables scroll zoom on simple map component<commit_after>import React from 'react';

import LoadingSpinner from '../Loading/LoadingSpinner';
import SimpleLegend from './SimpleLegend';


class SimpleMap extends React.Component {
  constructor() {
    super();
    this.state = {
      loading: false
    };
  }

  componentWillMount() {
    this.props.getLayerData(this.props.layerId);
  }

  componentDidMount() {
    this.initMap();
  }

  componentWillReceiveProps(props) {
    const layer = props.data[props.layerId] || false;
    if (layer) {
      this.updateMapPosition(layer);
      this.addMapLayer(layer);
    }
  }

  initMap() {
    const params = {
      zoom: 2,
      lat: 48.46038,
      lng: -123.889823
    };

    this.mapLayers = {};
    this.map = L.map(this.refs.map, {
      zoomControl: false,
      center: [+params.lat, +params.lng],
      zoom: +params.zoom,
      minZoom: 2,
      scrollWheelZoom: false
    });

    L.tileLayer(
      'http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png',
      { maxZoom: 18 }
    ).addTo(this.map, 1);
  }

  updateMapPosition(layer) {
    const center = layer.attributes['layer-config'].center;
    const zoom = layer.attributes['layer-config'].zoom;
    if (center && center.lat && center.lng && zoom) {
      this.map.setView(new L.LatLng(center.lat, center.lng), zoom);
    }
  }

  addMapLayer(layer) {
    if (!this.state.loading) {
{'fraction_non_alphanumeric': 0.15445687477444967, 'fraction_numerical': 0.015156983038614218, 'mean_word_length': 2.681274900398406, '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': '7235808', 'n_tokens_mistral': 999, 'n_tokens_neox': 940, 'n_words': 168}