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