onMapMoveEnd(viewportBoundsChanged, data) {
    const { viewportBounds, viewportCenter } = data;

    const routes = routeConfiguration();
    const searchPagePath = pathByRouteName('SearchPage', routes);
    const currentPath =
      typeof window !== 'undefined' && window.location && window.location.pathname;

    // When using the ReusableMapContainer onMapMoveEnd can fire from other pages than SearchPage too
    const isSearchPage = currentPath === searchPagePath;

    // If mapSearch url param is given
    // or original location search is rendered once,
    // we start to react to "mapmoveend" events by generating new searches
    // (i.e. 'moveend' event in Mapbox and 'bounds_changed' in Google Maps)
    if (viewportBoundsChanged && isSearchPage) {
      const { history, location, filterConfig } = this.props;

      // parse query parameters, including a custom attribute named category
      const { address, bounds, mapSearch, ...rest } = parse(location.search, {
        latlng: ['origin'],
        latlngBounds: ['bounds'],
      });

      //const viewportMapCenter = SearchMap.getMapCenter(map);
      const originMaybe = config.sortSearchByDistance ? { origin: viewportCenter } : {};

      const searchParams = {
        address,
        ...originMaybe,
        bounds: viewportBounds,
        mapSearch: true,
        ...validFilterParams(rest, filterConfig),
      };

      history.push(createResourceLocatorString('SearchPage', routes, {}, searchParams));
    }
  }
// when map is moved by user or viewport has changed
when map is moved by user or viewport has changed
when map is moved by user or viewport has changed
onMapMoveEnd(viewportBoundsChanged, data) {
    const { viewportBounds, viewportCenter } = data;
    const routes = routeConfiguration();
    const searchPagePath = pathByRouteName('SearchPage', routes);
    const currentPath =
      typeof window !== 'undefined' && window.location && window.location.pathname;
    const isSearchPage = currentPath === searchPagePath;
    if (viewportBoundsChanged && isSearchPage) {
      const { history, location, filterConfig } = this.props;
      const { address, bounds, mapSearch, ...rest } = parse(location.search, {
        latlng: ['origin'],
        latlngBounds: ['bounds'],
      });
      const originMaybe = config.sortSearchByDistance ? { origin: viewportCenter } : {};
      const searchParams = {
        address,
        ...originMaybe,
        bounds: viewportBounds,
        mapSearch: true,
        ...validFilterParams(rest, filterConfig),
      };
      history.push(createResourceLocatorString('SearchPage', routes, {}, searchParams));
    }
  }
onMapMoveEnd ( viewportBoundsChanged , data ) { const { viewportBounds , viewportCenter } = data ; const routes = routeConfiguration ( ) ; const searchPagePath = pathByRouteName ( 'SearchPage' , routes ) ; const currentPath = typeof window !== 'undefined' && window . location && window . location . pathname ; const isSearchPage = currentPath === searchPagePath ; if ( viewportBoundsChanged && isSearchPage ) { const { history , location , filterConfig } = this . props ; const { address , bounds , mapSearch , ... rest } = parse ( location . search , { latlng : [ 'origin' ] , latlngBounds : [ 'bounds' ] , } ) ; const originMaybe = config . sortSearchByDistance ? { origin : viewportCenter } : { } ; const searchParams = { address , ... originMaybe , bounds : viewportBounds , mapSearch : true , ... validFilterParams ( rest , filterConfig ) , } ; history . push ( createResourceLocatorString ( 'SearchPage' , routes , { } , searchParams ) ) ; } }
when map is moved by user or viewport has changed
when map is moved by user or viewport has changed
// When using the ReusableMapContainer onMapMoveEnd can fire from other pages than SearchPage too // If mapSearch url param is given // or original location search is rendered once, // we start to react to "mapmoveend" events by generating new searches // (i.e. 'moveend' event in Mapbox and 'bounds_changed' in Google Maps) // parse query parameters, including a custom attribute named category //const viewportMapCenter = SearchMap.getMapCenter(map);