Commit 79f02549 authored by Oleksii Savran's avatar Oleksii Savran

Map centering

parent f426970f
......@@ -550,7 +550,7 @@ class MapPage extends React.Component<IMapPageProps, any> {
const { mapInfo, mapLayers, currentTab, classes, filterCode, loading, suggestions, t, loadAccessionsMapInfo, apiUrl, initialPosition, initialZoom, myMaps, defaultLayer, addToMyMaps, removeMyMap, toggleMyMap } = this.props;
const position = initialPosition[0] && initialPosition[1] ? initialPosition : [5, 5];
const initialBounds = [
let initialBounds = [
[-40, 60],
[50, -50],
];
......@@ -561,16 +561,9 @@ class MapPage extends React.Component<IMapPageProps, any> {
return <ErrorMessage error={ mapInfo.error }/>;
}
if (mapInfo.data.bounds[0][0] !== null && mapInfo.data.bounds[1][0] !== null) {
if (Math.abs(mapInfo.data.bounds[0][0] - mapInfo.data.bounds[1][0]) < Math.abs(initialBounds[0][0] - initialBounds[1][0])) {
initialBounds[0][0] = mapInfo.data.bounds[0][0];
initialBounds[1][0] = mapInfo.data.bounds[1][0];
}
if (Math.abs(mapInfo.data.bounds[0][1] - mapInfo.data.bounds[1][1]) < Math.abs(initialBounds[0][1] - initialBounds[1][1])) {
initialBounds[0][1] = mapInfo.data.bounds[0][1];
initialBounds[1][1] = mapInfo.data.bounds[1][1];
}
}
if (mapInfo.data.bounds[0] && mapInfo.data.bounds[1] && mapInfo.data.bounds[0].length === 2 && mapInfo.data.bounds[1].length === 2) {
initialBounds = mapInfo.data.bounds;
}
const suggestionTerms = new Map();
if (suggestions) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment