Skip to content

Commit b2796f4

Browse files
committed
[#614] Fix bug and cleanup
1 parent a912229 commit b2796f4

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/components/Map/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {MapContainer, Marker, TileLayer, useMap, useMapEvent} from 'react-leafle
77
import {useGeolocation} from 'react-use';
88

99
import {ConfigContext} from 'Context';
10-
import {DEFAULT_LAT_LNG, DEFAULT_ZOOM, MAP_DEFAULTS, TILE_LAYER_RD} from 'map/constants';
10+
import {CRS_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, TILE_LAYER_RD} from 'map/constants';
1111
import {getBEMClassName} from 'utils';
1212

1313
import NearestAddress from './NearestAddress';
@@ -86,7 +86,7 @@ const LeaftletMap = ({
8686
center={defaultCenter}
8787
zoom={defaultZoomLevel}
8888
continuousWorld
89-
crs={MAP_DEFAULTS.crs}
89+
crs={CRS_RD}
9090
attributionControl
9191
className={className}
9292
searchControl
@@ -100,7 +100,7 @@ const LeaftletMap = ({
100100
duration: 3000,
101101
}}
102102
>
103-
<TileLayer url={TILE_LAYER_RD.url} {...TILE_LAYER_RD.options} />
103+
<TileLayer {...TILE_LAYER_RD} />
104104
{coordinates ? (
105105
<>
106106
<MapView coordinates={coordinates} />

src/formio/components/Map.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {IntlProvider} from 'react-intl';
88

99
import {ConfigContext} from 'Context';
1010
import LeafletMap from 'components/Map';
11-
import {DEFAULT_LAT_LNG, MAP_DEFAULTS} from 'map/constants';
11+
import {DEFAULT_LAT_LNG, DEFAULT_ZOOM} from 'map/constants';
1212

1313
const Field = Formio.Components.components.field;
1414

@@ -112,7 +112,7 @@ export default class Map extends Field {
112112
markerCoordinates={markerCoordinates || null}
113113
onMarkerSet={this.onMarkerSet.bind(this)}
114114
defaultCenter={defaultCenter}
115-
defaultZoomLevel={zoom || MAP_DEFAULTS.zoom}
115+
defaultZoomLevel={DEFAULT_ZOOM}
116116
/>
117117
</ConfigContext.Provider>
118118
</IntlProvider>

src/map/constants.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,4 @@ import {CRS_RD, TILES_ATTRIBUTION, TILE_LAYER_RD} from '@open-formulieren/leafle
77
const DEFAULT_LAT_LNG = [52.1326332, 5.291266];
88
const DEFAULT_ZOOM = 13;
99

10-
const MAP_DEFAULTS = {
11-
continuousWorld: true,
12-
crs: CRS_RD,
13-
attributionControl: true,
14-
center: DEFAULT_LAT_LNG,
15-
zoom: DEFAULT_ZOOM,
16-
};
17-
18-
export {TILES_ATTRIBUTION, TILE_LAYER_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, MAP_DEFAULTS};
10+
export {CRS_RD, DEFAULT_LAT_LNG, DEFAULT_ZOOM, TILES_ATTRIBUTION, TILE_LAYER_RD};

0 commit comments

Comments
 (0)