@eeacms/volto-marine-policy 2.0.24 → 2.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/package.json +2 -2
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesFilters.jsx +5 -5
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesListing.jsx +6 -3
- package/src/components/Blocks/DemoSitesExplorer/DemoSitesMap.jsx +21 -13
- package/src/components/Blocks/DemoSitesExplorer/FeatureDisplay.jsx +5 -5
- package/src/components/Blocks/DemoSitesExplorer/FeatureInteraction.jsx +7 -5
- package/src/components/Blocks/DemoSitesExplorer/InfoOverlay.jsx +17 -20
- package/src/components/Blocks/DemoSitesExplorer/ObjectivesChart.jsx +1 -0
- package/src/components/Blocks/DemoSitesExplorer/utils.js +7 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [2.0.26](https://github.com/eea/volto-marine-policy/compare/2.0.25...2.0.26) - 29 August 2025
|
|
8
|
+
|
|
9
|
+
#### :rocket: Dependency updates
|
|
10
|
+
|
|
11
|
+
- Release @eeacms/volto-searchlib@2.1.10 [EEA Jenkins - [`17445e9`](https://github.com/eea/volto-marine-policy/commit/17445e91fa8ff3c66ebabdbc6f3e474f643f6d03)]
|
|
12
|
+
|
|
13
|
+
#### :hammer_and_wrench: Others
|
|
14
|
+
|
|
15
|
+
- Demo Sites Explorer show indicators link in popup [laszlocseh - [`5214931`](https://github.com/eea/volto-marine-policy/commit/52149317e361ce8bd9b4e0adc9c17ec61b35ecc1)]
|
|
16
|
+
- Fix map popup [narcis2005 - [`dd99fd7`](https://github.com/eea/volto-marine-policy/commit/dd99fd7b3ff6327730690b6a5da262905e626593)]
|
|
17
|
+
- lint ignore line [Claudia Ifrim - [`5de8369`](https://github.com/eea/volto-marine-policy/commit/5de8369f3470ef3bb592fc851a44c90489771f84)]
|
|
18
|
+
- ol fix [Claudia Ifrim - [`8eacd1f`](https://github.com/eea/volto-marine-policy/commit/8eacd1f3121e593d645eaaa0e1b22fc84fe73ced)]
|
|
19
|
+
### [2.0.25](https://github.com/eea/volto-marine-policy/compare/2.0.24...2.0.25) - 27 August 2025
|
|
20
|
+
|
|
21
|
+
#### :hammer_and_wrench: Others
|
|
22
|
+
|
|
23
|
+
- pin volto-openlayers-map to 1.0.0 [Nilesh - [`49c4af6`](https://github.com/eea/volto-marine-policy/commit/49c4af6c0edd7473d753a193f8c98c1789818e0f)]
|
|
24
|
+
- fix volto-openlayers-map module resolving [nileshgulia1 - [`c27cfa7`](https://github.com/eea/volto-marine-policy/commit/c27cfa7a067b7c42fdc85a3b847001cd8e3db088)]
|
|
25
|
+
- eslint [nileshgulia1 - [`2c5300e`](https://github.com/eea/volto-marine-policy/commit/2c5300eba990cc4a3d4c3e87d69faa00d93e756c)]
|
|
26
|
+
- eslint . [nileshgulia1 - [`87664a3`](https://github.com/eea/volto-marine-policy/commit/87664a3f5252c4f41ca1a1b069fc3073627e2dcc)]
|
|
27
|
+
- fix imports [nileshgulia1 - [`9baee98`](https://github.com/eea/volto-marine-policy/commit/9baee9884012a41db83c178f3e3e1058ff6ae4ee)]
|
|
28
|
+
- update [nileshgulia1 - [`0d4694c`](https://github.com/eea/volto-marine-policy/commit/0d4694cc75d8c37e1d49fe4808b21e5de9dae9d3)]
|
|
29
|
+
- update open layers map config in simple data block refs#288034 [nileshgulia1 - [`cc14bb7`](https://github.com/eea/volto-marine-policy/commit/cc14bb7e178d111dc0e560d97c83b1f503b607bf)]
|
|
7
30
|
### [2.0.24](https://github.com/eea/volto-marine-policy/compare/2.0.23...2.0.24) - 27 August 2025
|
|
8
31
|
|
|
9
32
|
#### :rocket: New Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-marine-policy",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "@eeacms/volto-marine-policy: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@eeacms/volto-globalsearch": "2.1.2",
|
|
41
41
|
"@eeacms/volto-metadata-block": "*",
|
|
42
42
|
"@eeacms/volto-openlayers-map": "1.0.1",
|
|
43
|
-
"@eeacms/volto-searchlib": "2.1.
|
|
43
|
+
"@eeacms/volto-searchlib": "2.1.10",
|
|
44
44
|
"@eeacms/volto-tabs-block": "*",
|
|
45
45
|
"@eeacms/volto-workflow-progress": "*",
|
|
46
46
|
"@plone-collective/volto-authomatic": "2.0.1",
|
|
@@ -326,7 +326,7 @@ export function ActiveFilters(props) {
|
|
|
326
326
|
{activeFilters.objective_filter.map((filterCode) => {
|
|
327
327
|
const filterLabel = filters.objective_filter[filterCode];
|
|
328
328
|
return (
|
|
329
|
-
<div className="ui basic label filter-value">
|
|
329
|
+
<div key={filterCode} className="ui basic label filter-value">
|
|
330
330
|
<span>{filterLabel}</span>
|
|
331
331
|
<i
|
|
332
332
|
tabIndex="0"
|
|
@@ -352,7 +352,7 @@ export function ActiveFilters(props) {
|
|
|
352
352
|
{activeFilters.target_filter.map((filterCode) => {
|
|
353
353
|
const filterLabel = filters.target_filter[filterCode];
|
|
354
354
|
return (
|
|
355
|
-
<div className="ui basic label filter-value">
|
|
355
|
+
<div key={filterCode} className="ui basic label filter-value">
|
|
356
356
|
<span>{filterLabel}</span>
|
|
357
357
|
<i
|
|
358
358
|
tabIndex="0"
|
|
@@ -377,7 +377,7 @@ export function ActiveFilters(props) {
|
|
|
377
377
|
{activeFilters.indicator_filter.map((filterCode) => {
|
|
378
378
|
const filterLabel = filters.indicator_filter[filterCode];
|
|
379
379
|
return (
|
|
380
|
-
<div className="ui basic label filter-value">
|
|
380
|
+
<div key={filterCode} className="ui basic label filter-value">
|
|
381
381
|
<span>{filterLabel}</span>
|
|
382
382
|
<i
|
|
383
383
|
tabIndex="0"
|
|
@@ -402,7 +402,7 @@ export function ActiveFilters(props) {
|
|
|
402
402
|
{activeFilters.project_filter.map((filterCode) => {
|
|
403
403
|
const filterLabel = filters.project_filter[filterCode];
|
|
404
404
|
return (
|
|
405
|
-
<div className="ui basic label filter-value">
|
|
405
|
+
<div key={filterCode} className="ui basic label filter-value">
|
|
406
406
|
<span>{filterLabel}</span>
|
|
407
407
|
<i
|
|
408
408
|
tabIndex="0"
|
|
@@ -427,7 +427,7 @@ export function ActiveFilters(props) {
|
|
|
427
427
|
{activeFilters.country_filter.map((filterCode) => {
|
|
428
428
|
const filterLabel = filters.country_filter[filterCode];
|
|
429
429
|
return (
|
|
430
|
-
<div className="ui basic label filter-value">
|
|
430
|
+
<div key={filterCode} className="ui basic label filter-value">
|
|
431
431
|
<span>{filterLabel}</span>
|
|
432
432
|
<i
|
|
433
433
|
tabIndex="0"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { centerAndResetMapZoom, isValidURL } from './utils';
|
|
3
|
+
import { withOpenLayers } from '@eeacms/volto-openlayers-map';
|
|
3
4
|
|
|
4
5
|
const showPageNr = (pageNr, currentPage, numberOfPages) => {
|
|
5
6
|
// show first 5 pages
|
|
@@ -24,8 +25,8 @@ const showPageNr = (pageNr, currentPage, numberOfPages) => {
|
|
|
24
25
|
return false;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
const { selectedCase, onSelectedCase, pointsSource, map } = props;
|
|
28
|
+
function DemoSitesList(props) {
|
|
29
|
+
const { selectedCase, onSelectedCase, pointsSource, map, ol } = props;
|
|
29
30
|
// const reSearch = new RegExp(`\\b(${searchInput})\\b`, 'gi');
|
|
30
31
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
31
32
|
|
|
@@ -155,7 +156,7 @@ export default function DemoSitesList(props) {
|
|
|
155
156
|
// scrollToElement('search-input');
|
|
156
157
|
// reset map zoom
|
|
157
158
|
onSelectedCase(null);
|
|
158
|
-
centerAndResetMapZoom(map);
|
|
159
|
+
centerAndResetMapZoom({ map, ol });
|
|
159
160
|
map.getInteractions().array_[9].getFeatures().clear();
|
|
160
161
|
}}
|
|
161
162
|
>
|
|
@@ -376,3 +377,5 @@ export default function DemoSitesList(props) {
|
|
|
376
377
|
</>
|
|
377
378
|
);
|
|
378
379
|
}
|
|
380
|
+
|
|
381
|
+
export default withOpenLayers(DemoSitesList);
|
|
@@ -2,12 +2,17 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
Map,
|
|
7
|
+
Layer,
|
|
8
|
+
Layers,
|
|
9
|
+
Controls,
|
|
10
|
+
useMapContext,
|
|
11
|
+
} from '@eeacms/volto-openlayers-map/api';
|
|
12
|
+
import { withOpenLayers } from '@eeacms/volto-openlayers-map';
|
|
7
13
|
|
|
8
14
|
import InfoOverlay from './InfoOverlay';
|
|
9
15
|
import FeatureInteraction from './FeatureInteraction';
|
|
10
|
-
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
11
16
|
|
|
12
17
|
import {
|
|
13
18
|
centerAndResetMapZoom,
|
|
@@ -25,7 +30,7 @@ const MapContextGateway = ({ setMap }) => {
|
|
|
25
30
|
return null;
|
|
26
31
|
};
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
function DemoSitesMap(props) {
|
|
29
34
|
const {
|
|
30
35
|
items,
|
|
31
36
|
activeItems,
|
|
@@ -37,8 +42,9 @@ export default function DemoSitesMap(props) {
|
|
|
37
42
|
setMap,
|
|
38
43
|
highlightedIndex,
|
|
39
44
|
setHighlightedIndex,
|
|
45
|
+
ol,
|
|
40
46
|
} = props;
|
|
41
|
-
const features = getFeatures(items);
|
|
47
|
+
const features = getFeatures({ cases: items, ol });
|
|
42
48
|
const [resetMapButtonClass, setResetMapButtonClass] =
|
|
43
49
|
React.useState('inactive');
|
|
44
50
|
|
|
@@ -72,11 +78,11 @@ export default function DemoSitesMap(props) {
|
|
|
72
78
|
|
|
73
79
|
if (activeItems) {
|
|
74
80
|
pointsSource.clear();
|
|
75
|
-
pointsSource.addFeatures(getFeatures(activeItems));
|
|
81
|
+
pointsSource.addFeatures(getFeatures({ cases: activeItems, ol }));
|
|
76
82
|
// hideFilters && zoomMapToFeatures(map, getFeatures(activeItems));
|
|
77
83
|
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
78
84
|
}
|
|
79
|
-
}, [map, activeItems, pointsSource, hideFilters]);
|
|
85
|
+
}, [map, activeItems, pointsSource, hideFilters, ol]);
|
|
80
86
|
|
|
81
87
|
React.useEffect(() => {
|
|
82
88
|
if (!map) return null;
|
|
@@ -119,11 +125,11 @@ export default function DemoSitesMap(props) {
|
|
|
119
125
|
return () => {
|
|
120
126
|
map.un('moveend', moveendListener);
|
|
121
127
|
};
|
|
122
|
-
}, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass]);
|
|
128
|
+
}, [map, selectedCase, resetMapButtonClass, setResetMapButtonClass, ol]);
|
|
123
129
|
|
|
124
130
|
const clusterStyle = React.useMemo(
|
|
125
|
-
() => selectedClusterStyle(selectedCase),
|
|
126
|
-
[selectedCase],
|
|
131
|
+
() => selectedClusterStyle({ selectedCase, ol }),
|
|
132
|
+
[selectedCase, ol],
|
|
127
133
|
);
|
|
128
134
|
|
|
129
135
|
const MapWithSelection = React.useMemo(() => Map, []);
|
|
@@ -159,9 +165,9 @@ export default function DemoSitesMap(props) {
|
|
|
159
165
|
setHighlightedIndex(5);
|
|
160
166
|
if (hideFilters) {
|
|
161
167
|
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
162
|
-
centerAndResetMapZoom(map);
|
|
168
|
+
centerAndResetMapZoom({ map, ol });
|
|
163
169
|
} else {
|
|
164
|
-
centerAndResetMapZoom(map);
|
|
170
|
+
centerAndResetMapZoom({ map, ol });
|
|
165
171
|
// zoomMapToFeatures(map, getFeatures(activeItems));
|
|
166
172
|
}
|
|
167
173
|
map.getInteractions().array_[9].getFeatures().clear();
|
|
@@ -194,7 +200,7 @@ export default function DemoSitesMap(props) {
|
|
|
194
200
|
) : null;
|
|
195
201
|
}
|
|
196
202
|
|
|
197
|
-
const selectedClusterStyle = (selectedFeature) => {
|
|
203
|
+
const selectedClusterStyle = ({ selectedFeature, ol }) => {
|
|
198
204
|
function _clusterStyle(feature, selectedFeature) {
|
|
199
205
|
const size = feature.get('features').length;
|
|
200
206
|
let clusterStyle = styleCache[size];
|
|
@@ -247,3 +253,5 @@ const selectedClusterStyle = (selectedFeature) => {
|
|
|
247
253
|
}
|
|
248
254
|
return _clusterStyle;
|
|
249
255
|
};
|
|
256
|
+
|
|
257
|
+
export default withOpenLayers(DemoSitesMap);
|
|
@@ -102,13 +102,13 @@ export default function FeatureDisplay({ feature }) {
|
|
|
102
102
|
{feature.indicators.map((item, index) => {
|
|
103
103
|
return (
|
|
104
104
|
<li key={index}>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
<a
|
|
106
|
+
target="_blank"
|
|
107
|
+
rel="noopener noreferrer"
|
|
108
|
+
href={item['path']}
|
|
109
109
|
>
|
|
110
110
|
{item['title']}
|
|
111
|
-
</
|
|
111
|
+
</a>
|
|
112
112
|
</li>
|
|
113
113
|
);
|
|
114
114
|
})}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { withOpenLayers } from '@eeacms/volto-openlayers-map';
|
|
3
3
|
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
4
4
|
// import { zoomMapToFeatures } from './utils';
|
|
5
5
|
|
|
6
|
-
export const useStyles = () => {
|
|
6
|
+
export const useStyles = ({ ol }) => {
|
|
7
7
|
const selected = React.useMemo(
|
|
8
8
|
() =>
|
|
9
9
|
new ol.style.Style({
|
|
@@ -18,7 +18,7 @@ export const useStyles = () => {
|
|
|
18
18
|
}),
|
|
19
19
|
}),
|
|
20
20
|
}),
|
|
21
|
-
[],
|
|
21
|
+
[ol],
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const selectStyle = React.useCallback(
|
|
@@ -35,10 +35,10 @@ export const useStyles = () => {
|
|
|
35
35
|
return { selected, selectStyle };
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function FeatureInteraction({ onFeatureSelect, ol }) {
|
|
39
39
|
// console.log('featureinteraction', selectedCase);
|
|
40
40
|
const { map } = useMapContext();
|
|
41
|
-
const { selectStyle } = useStyles();
|
|
41
|
+
const { selectStyle } = useStyles({ ol });
|
|
42
42
|
|
|
43
43
|
const select = new ol.interaction.Select({
|
|
44
44
|
condition: ol.condition.click,
|
|
@@ -88,3 +88,5 @@ export default function FeatureInteraction({ onFeatureSelect }) {
|
|
|
88
88
|
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
export default withOpenLayers(FeatureInteraction);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useMapContext } from '@eeacms/volto-openlayers-map/api';
|
|
3
|
-
import {
|
|
3
|
+
import { withOpenLayers } from '@eeacms/volto-openlayers-map';
|
|
4
4
|
import FeatureDisplay from './FeatureDisplay';
|
|
5
5
|
import { usePrevious } from '@plone/volto/helpers/Utils/usePrevious';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
selectedFeature,
|
|
9
|
-
onFeatureSelect,
|
|
10
|
-
layerId,
|
|
11
|
-
// hideFilters,
|
|
12
|
-
}) {
|
|
7
|
+
function InfoOverlay({ selectedFeature, onFeatureSelect, layerId, ol }) {
|
|
13
8
|
const { map } = useMapContext();
|
|
14
|
-
const [tooltip, setTooltipRef] = React.useState();
|
|
15
|
-
const
|
|
16
|
-
|
|
9
|
+
const [tooltip, setTooltipRef] = React.useState(null);
|
|
10
|
+
const overlayRef = React.useRef();
|
|
17
11
|
const prevLayerId = usePrevious(layerId);
|
|
12
|
+
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
18
13
|
|
|
19
14
|
React.useEffect(() => {
|
|
20
15
|
if (prevLayerId && layerId !== prevLayerId) {
|
|
@@ -23,10 +18,10 @@ export default function InfoOverlay({
|
|
|
23
18
|
}, [layerId, prevLayerId]);
|
|
24
19
|
|
|
25
20
|
React.useEffect(() => {
|
|
26
|
-
if (!(map && tooltip)) return;
|
|
21
|
+
if (!(map && tooltip && ol.Overlay)) return;
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
element:
|
|
23
|
+
overlayRef.current = new ol.Overlay({
|
|
24
|
+
element: tooltip,
|
|
30
25
|
positioning: 'bottom-left',
|
|
31
26
|
offset: [0, 0],
|
|
32
27
|
stopEvent: false,
|
|
@@ -35,7 +30,7 @@ export default function InfoOverlay({
|
|
|
35
30
|
// duration: 250,
|
|
36
31
|
// },
|
|
37
32
|
});
|
|
38
|
-
map.addOverlay(
|
|
33
|
+
map.addOverlay(overlayRef.current);
|
|
39
34
|
|
|
40
35
|
function handler(evt) {
|
|
41
36
|
const { pixel, target } = evt;
|
|
@@ -44,15 +39,13 @@ export default function InfoOverlay({
|
|
|
44
39
|
|
|
45
40
|
if (features.length) {
|
|
46
41
|
const coordinate = evt.coordinate;
|
|
47
|
-
|
|
42
|
+
overlayRef.current.setPosition(coordinate);
|
|
48
43
|
setShowTooltip(true);
|
|
49
44
|
} else {
|
|
50
|
-
// const coordinate = evt.coordinate
|
|
51
|
-
// overlay.setPosition(coordinate);
|
|
52
45
|
// handle a click in an overlay popup
|
|
53
46
|
if (evt.originalEvent.target.tagName === 'A') return;
|
|
47
|
+
overlayRef.current.setPosition(undefined);
|
|
54
48
|
setShowTooltip(false);
|
|
55
|
-
// popupOverlay.style.display = 'none';
|
|
56
49
|
onFeatureSelect(null);
|
|
57
50
|
}
|
|
58
51
|
}
|
|
@@ -61,9 +54,11 @@ export default function InfoOverlay({
|
|
|
61
54
|
|
|
62
55
|
return () => {
|
|
63
56
|
map.un('click', handler);
|
|
64
|
-
|
|
57
|
+
if (overlayRef.current) {
|
|
58
|
+
map.removeOverlay(overlayRef.current);
|
|
59
|
+
}
|
|
65
60
|
};
|
|
66
|
-
}, [map, tooltip, onFeatureSelect]);
|
|
61
|
+
}, [map, tooltip, onFeatureSelect, ol.Overlay]);
|
|
67
62
|
|
|
68
63
|
const [isClient, setIsClient] = React.useState(false);
|
|
69
64
|
React.useEffect(() => setIsClient(true), []);
|
|
@@ -82,3 +77,5 @@ export default function InfoOverlay({
|
|
|
82
77
|
</div>
|
|
83
78
|
) : null;
|
|
84
79
|
}
|
|
80
|
+
|
|
81
|
+
export default withOpenLayers(InfoOverlay);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { openlayers as ol } from '@eeacms/volto-openlayers-map';
|
|
2
|
-
|
|
3
1
|
export const objectivesCustomOrder = [
|
|
4
2
|
'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity',
|
|
5
3
|
'Objective 2: Prevent and eliminate pollution of our oceans, seas and waters',
|
|
@@ -41,7 +39,7 @@ export function isValidURL(string) {
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
export function centerAndResetMapZoom(map) {
|
|
42
|
+
export function centerAndResetMapZoom({ map, ol }) {
|
|
45
43
|
map.getView().animate({
|
|
46
44
|
zoom: 3.4,
|
|
47
45
|
duration: 1000,
|
|
@@ -56,14 +54,14 @@ export function scrollToElement(elementId) {
|
|
|
56
54
|
});
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
export function getExtentOfFeatures(features) {
|
|
57
|
+
export function getExtentOfFeatures({ features, ol }) {
|
|
60
58
|
const points = features.map((f) => f.getGeometry().flatCoordinates);
|
|
61
59
|
const point = new ol.geom.MultiPoint(points);
|
|
62
60
|
return point.getExtent();
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
export function zoomMapToFeatures(map, features, threshold = 500) {
|
|
66
|
-
const extent = getExtentOfFeatures(features);
|
|
63
|
+
export function zoomMapToFeatures({ map, features, ol, threshold = 500 }) {
|
|
64
|
+
const extent = getExtentOfFeatures({ map, features, ol });
|
|
67
65
|
|
|
68
66
|
// let extentBuffer = (extent[3] - extent[1] + extent[2] - extent[0]) / 4;
|
|
69
67
|
// extentBuffer = extentBuffer < threshold ? threshold : extentBuffer;
|
|
@@ -89,8 +87,8 @@ export function zoomMapToFeatures(map, features, threshold = 500) {
|
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
export function getFeatures(cases) {
|
|
93
|
-
const Feature = ol.
|
|
90
|
+
export function getFeatures({ cases, ol }) {
|
|
91
|
+
const Feature = ol.Feature; // eslint-disable-line no-unused-vars
|
|
94
92
|
const colors = {
|
|
95
93
|
'Objective 1: Protect and restore marine and freshwater ecosystems and biodiversity':
|
|
96
94
|
'#007b6c',
|
|
@@ -115,7 +113,7 @@ export function getFeatures(cases) {
|
|
|
115
113
|
const {
|
|
116
114
|
geometry: { coordinates },
|
|
117
115
|
} = c;
|
|
118
|
-
const point = new Feature(
|
|
116
|
+
const point = new ol.ol.Feature(
|
|
119
117
|
new ol.geom.Point(ol.proj.fromLonLat(coordinates)),
|
|
120
118
|
);
|
|
121
119
|
point.setId(index);
|