componentDidMount()

in public/js/components/map.js [43:74]


  componentDidMount() {
    this._maplibreMap = new maplibre.Map({
      container: this.refs.mapContainer,
      style: {
        version: 8,
        sources: {},
        layers: [],
      },
      transformRequest: (url) => {
        return { url: new URL(url, window.location.origin).href };
      },
    });

    this._maplibreMap.addControl(new maplibre.FullscreenControl());

    this._maplibreMap.dragRotate.disable();
    this._maplibreMap.touchZoomRotate.disableRotation();

    this._maplibreMap.on('click', this._overlayFillLayerId, (e) => {
      this._highlightFeature(e.features[0], e.lngLat);
    });

    // Change the cursor to a pointer when the mouse is over the places layer.
    this._maplibreMap.on('mouseenter', this._overlayFillLayerId, () => {
      this._maplibreMap.getCanvas().style.cursor = 'pointer';
    });

    // Change it back to a pointer when it leaves.
    this._maplibreMap.on('mouseleave', this._overlayFillLayerId, () => {
      this._maplibreMap.getCanvas().style.cursor = '';
    });
  }