@performant-software/geospatial 1.1.5-beta.1 → 1.1.5
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
|
|
3
|
-
import React, { useEffect, useMemo } from 'react';
|
|
4
3
|
import { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
5
|
import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles';
|
|
6
6
|
import MapUtils from '../utils/Map';
|
|
7
7
|
|
|
@@ -22,19 +22,19 @@ type Props = {
|
|
|
22
22
|
fillStyle?: { [key: string]: any },
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* TOOD: Comment me.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
map?: Map,
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* GeoJSON layer
|
|
30
|
+
* GeoJSON layer point style.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
pointStyle?: { [key: string]: any },
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* GeoJSON layer stroke style
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
strokeStyle?: { [key: string]: any }
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const DEFAULT_BUFFER = 2;
|
|
@@ -43,17 +43,15 @@ const DEFAULT_BUFFER = 2;
|
|
|
43
43
|
* This component renders a location marker to be used in a Peripleo context.
|
|
44
44
|
*/
|
|
45
45
|
const LocationMarker = (props: Props) => {
|
|
46
|
-
const map = useMemo(() => props.useMap(), [props.useMap]);
|
|
47
|
-
|
|
48
46
|
/**
|
|
49
47
|
* Sets the bounding box on the map.
|
|
50
48
|
*/
|
|
51
49
|
useEffect(() => {
|
|
52
|
-
if (map && props.data) {
|
|
50
|
+
if (props.map && props.data) {
|
|
53
51
|
const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer);
|
|
54
|
-
map.fitBounds(boundingBox);
|
|
52
|
+
props.map.fitBounds(boundingBox);
|
|
55
53
|
}
|
|
56
|
-
}, [
|
|
54
|
+
}, [props.buffer, props.data, props.map]);
|
|
57
55
|
|
|
58
56
|
return (
|
|
59
57
|
<>
|