Skip to content

Commit

Permalink
[#614] Fix bug and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Jan 15, 2024
1 parent a912229 commit 0764db1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/components/Map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {MapContainer, Marker, TileLayer, useMap, useMapEvent} from 'react-leafle
import {useGeolocation} from 'react-use';

import {ConfigContext} from 'Context';
import {DEFAULT_LAT_LNG, DEFAULT_ZOOM, MAP_DEFAULTS, TILE_LAYER_RD} from 'map/constants';
import {CRS_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, TILE_LAYER_RD} from 'map/constants';
import {getBEMClassName} from 'utils';

import NearestAddress from './NearestAddress';
Expand Down Expand Up @@ -86,7 +86,7 @@ const LeaftletMap = ({
center={defaultCenter}
zoom={defaultZoomLevel}
continuousWorld
crs={MAP_DEFAULTS.crs}
crs={CRS_RD}
attributionControl
className={className}
searchControl
Expand All @@ -100,7 +100,7 @@ const LeaftletMap = ({
duration: 3000,
}}
>
<TileLayer url={TILE_LAYER_RD.url} {...TILE_LAYER_RD.options} />
<TileLayer {...TILE_LAYER_RD} />
{coordinates ? (
<>
<MapView coordinates={coordinates} />
Expand Down
4 changes: 2 additions & 2 deletions src/formio/components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IntlProvider} from 'react-intl';

import {ConfigContext} from 'Context';
import LeafletMap from 'components/Map';
import {DEFAULT_LAT_LNG, MAP_DEFAULTS} from 'map/constants';
import {DEFAULT_LAT_LNG, DEFAULT_ZOOM} from 'map/constants';

const Field = Formio.Components.components.field;

Expand Down Expand Up @@ -112,7 +112,7 @@ export default class Map extends Field {
markerCoordinates={markerCoordinates || null}
onMarkerSet={this.onMarkerSet.bind(this)}
defaultCenter={defaultCenter}
defaultZoomLevel={zoom || MAP_DEFAULTS.zoom}
defaultZoomLevel={zoom || DEFAULT_ZOOM}
/>
</ConfigContext.Provider>
</IntlProvider>
Expand Down
10 changes: 1 addition & 9 deletions src/map/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,4 @@ import {CRS_RD, TILES_ATTRIBUTION, TILE_LAYER_RD} from '@open-formulieren/leafle
const DEFAULT_LAT_LNG = [52.1326332, 5.291266];
const DEFAULT_ZOOM = 13;

const MAP_DEFAULTS = {
continuousWorld: true,
crs: CRS_RD,
attributionControl: true,
center: DEFAULT_LAT_LNG,
zoom: DEFAULT_ZOOM,
};

export {TILES_ATTRIBUTION, TILE_LAYER_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, MAP_DEFAULTS};
export {CRS_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, TILES_ATTRIBUTION, TILE_LAYER_RD};

0 comments on commit 0764db1

Please sign in to comment.