@mapcomponents/react-maplibre 0.1.8 → 0.1.12

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.
Files changed (82) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +2 -2
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +3 -3
  3. package/.github/workflows/node_version_test.yml +25 -0
  4. package/.github/workflows/storybook.yml +6 -3
  5. package/CODE_OF_CONDUCT.md +70 -0
  6. package/CONTRIBUTING.md +149 -0
  7. package/README.md +16 -9
  8. package/coverage/clover.xml +76 -72
  9. package/coverage/coverage-final.json +2 -2
  10. package/coverage/lcov-report/block-navigation.js +8 -0
  11. package/coverage/lcov-report/components/MapLibreMap/MapLibreMap.js.html +8 -2
  12. package/coverage/lcov-report/components/MapLibreMap/index.html +8 -2
  13. package/coverage/lcov-report/components/MlCreatePdfButton/MlCreatePdfButton.js.html +8 -2
  14. package/coverage/lcov-report/components/MlCreatePdfButton/index.html +8 -2
  15. package/coverage/lcov-report/components/MlFeatureEditor/MlFeatureEditor.js.html +8 -2
  16. package/coverage/lcov-report/components/MlFeatureEditor/index.html +8 -2
  17. package/coverage/lcov-report/components/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +8 -2
  18. package/coverage/lcov-report/components/MlFillExtrusionLayer/index.html +8 -2
  19. package/coverage/lcov-report/components/MlFollowGps/MlFollowGps.js.html +53 -8
  20. package/coverage/lcov-report/components/MlFollowGps/index.html +18 -12
  21. package/coverage/lcov-report/components/MlGPXViewer/MlGPXViewer.js.html +8 -2
  22. package/coverage/lcov-report/components/MlGPXViewer/gpxConverter.js.html +8 -2
  23. package/coverage/lcov-report/components/MlGPXViewer/index.html +8 -2
  24. package/coverage/lcov-report/components/MlGeoJsonLayer/MlGeoJsonLayer.js.html +35 -17
  25. package/coverage/lcov-report/components/MlGeoJsonLayer/index.html +26 -20
  26. package/coverage/lcov-report/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html +8 -2
  27. package/coverage/lcov-report/components/MlImageMarkerLayer/index.html +8 -2
  28. package/coverage/lcov-report/components/MlLayer/MlLayer.js.html +8 -2
  29. package/coverage/lcov-report/components/MlLayer/index.html +8 -2
  30. package/coverage/lcov-report/components/MlLayerMagnify/MlLayerMagnify.js.html +8 -2
  31. package/coverage/lcov-report/components/MlLayerMagnify/index.html +8 -2
  32. package/coverage/lcov-report/components/MlLayerSwipe/MlLayerSwipe.js.html +8 -2
  33. package/coverage/lcov-report/components/MlLayerSwipe/index.html +8 -2
  34. package/coverage/lcov-report/components/MlMarker/MlMarker.js.html +8 -2
  35. package/coverage/lcov-report/components/MlMarker/index.html +8 -2
  36. package/coverage/lcov-report/components/MlNavigationCompass/MlNavigationCompass.js.html +8 -2
  37. package/coverage/lcov-report/components/MlNavigationCompass/index.html +8 -2
  38. package/coverage/lcov-report/components/MlNavigationTools/MlNavigationTools.js.html +8 -2
  39. package/coverage/lcov-report/components/MlNavigationTools/index.html +8 -2
  40. package/coverage/lcov-report/components/MlOsmLayer/MlOsmLayer.js.html +8 -2
  41. package/coverage/lcov-report/components/MlOsmLayer/index.html +8 -2
  42. package/coverage/lcov-report/components/MlScaleReference/MlScaleReference.js.html +8 -2
  43. package/coverage/lcov-report/components/MlScaleReference/index.html +8 -2
  44. package/coverage/lcov-report/components/MlShareMapState/MlShareMapState.js.html +8 -2
  45. package/coverage/lcov-report/components/MlShareMapState/index.html +8 -2
  46. package/coverage/lcov-report/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +8 -2
  47. package/coverage/lcov-report/components/MlSpatialElevationProfile/index.html +8 -2
  48. package/coverage/lcov-report/components/MlThreeJsLayer/MlThreeJsLayer.js.html +8 -2
  49. package/coverage/lcov-report/components/MlThreeJsLayer/index.html +8 -2
  50. package/coverage/lcov-report/components/MlUseMapDebugger/MlUseMapDebugger.js.html +8 -2
  51. package/coverage/lcov-report/components/MlUseMapDebugger/index.html +8 -2
  52. package/coverage/lcov-report/components/MlVectorTileLayer/MlVectorTileLayer.js.html +8 -2
  53. package/coverage/lcov-report/components/MlVectorTileLayer/index.html +8 -2
  54. package/coverage/lcov-report/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +8 -2
  55. package/coverage/lcov-report/components/MlWmsFeatureInfoPopup/index.html +8 -2
  56. package/coverage/lcov-report/components/MlWmsLayer/MlWmsLayer.js.html +8 -2
  57. package/coverage/lcov-report/components/MlWmsLayer/index.html +8 -2
  58. package/coverage/lcov-report/components/MlWmsLoader/MlWmsLoader.js.html +8 -2
  59. package/coverage/lcov-report/components/MlWmsLoader/index.html +8 -2
  60. package/coverage/lcov-report/hooks/index.html +8 -2
  61. package/coverage/lcov-report/hooks/useMap.js.html +8 -2
  62. package/coverage/lcov-report/hooks/useMapState.js.html +8 -2
  63. package/coverage/lcov-report/hooks/useWms.js.html +8 -2
  64. package/coverage/lcov-report/index.html +32 -26
  65. package/coverage/lcov-report/sorter.js +26 -0
  66. package/coverage/lcov.info +153 -149
  67. package/dist/index.esm.js +68 -38
  68. package/dist/index.esm.js.map +1 -1
  69. package/package.json +1 -1
  70. package/rollup.config.js +10 -2
  71. package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta.json +1 -1
  72. package/src/components/MlFollowGps/MlFollowGps.js +14 -1
  73. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +8 -4
  74. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -1
  75. package/src/components/MlGeoJsonLayer/util/transitionFunctions.js +19 -12
  76. package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +3 -3
  77. package/src/decorators/MapContextDashboardDecorator.js +0 -5
  78. package/src/decorators/MapContextDecorator.js +0 -5
  79. package/src/decorators/MapContextKlokantechBasicDecorator.js +0 -5
  80. package/src/decorators/MultiMapContextDecorator.js +0 -5
  81. package/src/hooks/useMapState.stories.js +7 -2
  82. package/src/ui_components/Sidebar.js +7 -8
package/dist/index.esm.js CHANGED
@@ -1244,18 +1244,25 @@ MlCreatePdfButton.propTypes = {
1244
1244
  mapId: PropTypes.string
1245
1245
  };
1246
1246
 
1247
- var _showNextTransitionSegment = function _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep) {
1247
+ var _showNextTransitionSegment = function _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef) {
1248
1248
  var _arguments = arguments;
1249
1249
 
1250
1250
  if (typeof map.getSource(layerId) === "undefined" || !transitionInProgressRef.current) {
1251
- setTimeout(function () {
1251
+ transitionTimeoutRef.current = setTimeout(function () {
1252
1252
  return _showNextTransitionSegment.apply(void 0, _toConsumableArray(_arguments));
1253
1253
  }, msPerStep);
1254
1254
  return;
1255
1255
  }
1256
1256
 
1257
1257
  if (typeof transitionGeojsonDataRef.current[currentTransitionStepRef.current] !== "undefined") {
1258
+ var _map$getSource;
1259
+
1258
1260
  var newData = currentTransitionStepRef.current + 1 === transitionGeojsonDataRef.current.length ? props.geojson : lineString([].concat(_toConsumableArray(transitionGeojsonCommonDataRef.current), _toConsumableArray(transitionGeojsonDataRef.current[currentTransitionStepRef.current].geometry.coordinates)));
1261
+
1262
+ if (!(map !== null && map !== void 0 && (_map$getSource = map.getSource) !== null && _map$getSource !== void 0 && _map$getSource.call(map, layerId))) {
1263
+ return;
1264
+ }
1265
+
1259
1266
  map.getSource(layerId).setData(newData);
1260
1267
 
1261
1268
  if (typeof props.onTransitionFrame === "function") {
@@ -1265,7 +1272,7 @@ var _showNextTransitionSegment = function _showNextTransitionSegment(props, laye
1265
1272
  currentTransitionStepRef.current++;
1266
1273
 
1267
1274
  if (transitionInProgressRef.current && currentTransitionStepRef.current < transitionGeojsonDataRef.current.length) {
1268
- setTimeout(function () {
1275
+ transitionTimeoutRef.current = setTimeout(function () {
1269
1276
  return _showNextTransitionSegment.apply(void 0, _toConsumableArray(_arguments));
1270
1277
  }, msPerStep);
1271
1278
  } else {
@@ -1278,7 +1285,7 @@ var _showNextTransitionSegment = function _showNextTransitionSegment(props, laye
1278
1285
  }
1279
1286
  };
1280
1287
 
1281
- var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, map, layerId) {
1288
+ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, map, layerId, transitionTimeoutRef) {
1282
1289
  // create the transition geojson between oldGeojsonRef.current and props.geojson
1283
1290
  // create a geojson that contains no common point between the two line features
1284
1291
  var transitionCoordinatesShort = [];
@@ -1361,11 +1368,11 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
1361
1368
 
1362
1369
  tmpLinestring = tmpChunks.features[1];
1363
1370
 
1364
- for (i = 1; i < srcTransitionSteps; i++) {
1371
+ for (i = 0; i < srcTransitionSteps; i++) {
1365
1372
  transitionGeojsonDataRef.current.push(tmpLinestring);
1366
1373
 
1367
- if (typeof tmpChunks.features[i + 1] !== "undefined") {
1368
- tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i + 1].geometry.coordinates)));
1374
+ if (typeof tmpChunks.features[i] !== "undefined") {
1375
+ tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
1369
1376
  } else {
1370
1377
  transitionGeojsonDataRef.current.push(tmpLinestring);
1371
1378
  break;
@@ -1380,11 +1387,11 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
1380
1387
 
1381
1388
  tmpLinestring = tmpChunks.features[1];
1382
1389
 
1383
- for (i = 1; i < targetTransitionSteps; i++) {
1390
+ for (i = 0; i < targetTransitionSteps; i++) {
1384
1391
  transitionGeojsonDataRef.current.push(tmpLinestring);
1385
1392
 
1386
- if (typeof tmpChunks.features[i + 1] !== "undefined") {
1387
- tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i + 1].geometry.coordinates)));
1393
+ if (typeof tmpChunks.features[i] !== "undefined") {
1394
+ tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
1388
1395
  } else {
1389
1396
  transitionGeojsonDataRef.current.push(tmpLinestring);
1390
1397
  break;
@@ -1395,8 +1402,8 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
1395
1402
  transitionGeojsonDataRef.current.push(props.geojson);
1396
1403
  currentTransitionStepRef.current = 1;
1397
1404
  transitionInProgressRef.current = true;
1398
- setTimeout(function () {
1399
- return _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep);
1405
+ transitionTimeoutRef.current = setTimeout(function () {
1406
+ return _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef);
1400
1407
  }, msPerStep);
1401
1408
  };
1402
1409
 
@@ -1414,6 +1421,7 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1414
1421
  var mapRef = useRef(null);
1415
1422
  var initializedRef = useRef(false);
1416
1423
  var transitionInProgressRef = useRef(false);
1424
+ var transitionTimeoutRef = useRef(undefined);
1417
1425
  var currentTransitionStepRef = useRef(false);
1418
1426
  var transitionGeojsonDataRef = useRef([]);
1419
1427
  var transitionGeojsonCommonDataRef = useRef([]);
@@ -1423,6 +1431,10 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1423
1431
  var _componentId = componentId.current;
1424
1432
  return function () {
1425
1433
  // This is the cleanup function, it is called when this react component is removed from react-dom
1434
+ if (transitionTimeoutRef.current) {
1435
+ clearTimeout(transitionTimeoutRef.current);
1436
+ }
1437
+
1426
1438
  if (mapRef.current) {
1427
1439
  mapRef.current.cleanup(_componentId);
1428
1440
  mapRef.current = null;
@@ -1438,7 +1450,7 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1438
1450
  }
1439
1451
  }, [props.paint, mapContext, props.mapId]);
1440
1452
  var transitionToGeojson = useCallback(function (newGeojson) {
1441
- _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapRef.current, componentId.current);
1453
+ _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapRef.current, componentId.current, transitionTimeoutRef);
1442
1454
  }, [props]);
1443
1455
  useEffect(function () {
1444
1456
  var _mapRef$current, _mapRef$current$getSo;
@@ -1499,9 +1511,7 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1499
1511
 
1500
1512
  if (props.type === "line" && typeof props.transitionTime !== "undefined" && typeof props.geojson.geometry !== "undefined") {
1501
1513
  transitionToGeojson(props.geojson);
1502
- setTimeout(function () {
1503
- oldGeojsonRef.current = props.geojson;
1504
- }, props.transitionTime / 2);
1514
+ oldGeojsonRef.current = props.geojson;
1505
1515
  }
1506
1516
  }
1507
1517
  }, [mapContext.mapIds, mapContext, props, transitionToGeojson]);
@@ -1648,46 +1658,56 @@ var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
1648
1658
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
1649
1659
  };
1650
1660
 
1651
- var _path;
1652
-
1653
1661
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1654
1662
 
1655
1663
  function SvgRotateRight(props) {
1656
1664
  return /*#__PURE__*/createElement("svg", _extends({
1657
- width: 149.953,
1658
- height: 394.094,
1659
- viewBox: "0 0 39.675 104.271"
1660
- }, props), _path || (_path = /*#__PURE__*/createElement("path", {
1661
- d: "M31.122 0L0 8.552l14.476 8.235c-5.82 11.005-8.692 22.459-10.142 33.84C2.52 64.103 2.758 78.141 9.69 91.76c1.58 3.103 3.614 6.243 6.453 9.278a28.1 28.1 0 002.415 2.297 18.762 18.762 0 001.051.823l.154.113 9.149-4.002-.09-.058-.048-.035a10.24 10.24 0 01-.413-.33 20.703 20.703 0 01-1.757-1.678c-2.328-2.453-4.049-5.159-5.514-7.974-6.462-12.41-6.555-25.674-4.916-38.81 1.308-9.888 3.613-19.707 7.992-29.085l15.51 8.823z"
1665
+ width: "39.675098mm",
1666
+ height: "104.27064mm",
1667
+ viewBox: "0 0 39.675098 104.27064"
1668
+ }, props), /*#__PURE__*/createElement("g", {
1669
+ transform: "translate(-86.019554,-58.032633)"
1670
+ }, /*#__PURE__*/createElement("path", {
1671
+ style: {
1672
+ strokeWidth: 0.744756
1673
+ },
1674
+ d: "m 442.74023,219.33594 -117.62695,32.32422 54.71094,31.12304 c -21.99397,41.5931 -32.8507,84.88283 -38.33008,127.89649 -6.86182,50.94051 -5.95715,103.99765 20.23828,155.46484 5.97246,11.72776 13.65817,23.59773 24.38867,35.06641 2.6597,2.84073 5.65602,5.75455 9.12891,8.68164 0.87557,0.7378 1.85363,1.52609 2.95117,2.35547 0.29669,0.22563 0.63616,0.47742 1.02149,0.75586 l 0.58203,0.42578 34.57812,-15.12305 -0.33789,-0.2207 c -0.0265,-0.0151 -0.0842,-0.0587 -0.18359,-0.13086 -0.46723,-0.34885 -0.9819,-0.76796 -1.56055,-1.25 -2.29757,-1.91343 -4.46539,-4.04643 -6.64062,-6.33985 -8.80052,-9.27114 -15.30333,-19.4993 -20.83985,-30.13867 -24.42289,-46.90715 -24.77465,-97.03535 -18.58008,-146.68164 4.94388,-37.37493 13.65299,-74.4847 30.20508,-109.92969 l 58.6211,33.34766 z",
1675
+ transform: "scale(0.26458333)"
1662
1676
  })));
1663
1677
  }
1664
1678
 
1665
- var _path$1;
1679
+ var _g;
1666
1680
 
1667
1681
  function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
1668
1682
 
1669
1683
  function SvgRotateLeft(props) {
1670
1684
  return /*#__PURE__*/createElement("svg", _extends$1({
1671
- width: 149.953,
1672
- height: 394.094,
1673
- viewBox: "0 0 39.675 104.271"
1674
- }, props), _path$1 || (_path$1 = /*#__PURE__*/createElement("path", {
1675
- d: "M8.553 0l31.122 8.552L25.2 16.787c5.82 11.005 8.692 22.459 10.142 33.84 1.816 13.477 1.576 27.515-5.355 41.133-1.58 3.103-3.613 6.243-6.453 9.278a28.1 28.1 0 01-2.415 2.297 18.768 18.768 0 01-1.051.823l-.154.113-9.149-4.002.09-.058.048-.035c.124-.092.26-.203.413-.33a20.702 20.702 0 001.757-1.678c2.329-2.453 4.05-5.159 5.514-7.974 6.462-12.41 6.555-25.674 4.916-38.81-1.308-9.888-3.612-19.707-7.992-29.085L0 31.122z"
1676
- })));
1685
+ width: "39.675098mm",
1686
+ height: "104.27064mm",
1687
+ viewBox: "0 0 39.675098 104.27064"
1688
+ }, props), _g || (_g = /*#__PURE__*/createElement("g", {
1689
+ transform: "translate(-86.019554,-58.032633)"
1690
+ }, /*#__PURE__*/createElement("path", {
1691
+ d: "m 94.572523,58.032633 31.122127,8.55245 -14.4756,8.234638 c 5.81924,11.004841 8.69175,22.458582 10.1415,33.839279 1.81552,13.47801 1.57616,27.51604 -5.35471,41.13341 -1.58021,3.10296 -3.61373,6.24356 -6.45284,9.27798 -0.70371,0.75161 -1.49649,1.52256 -2.41535,2.29702 -0.23167,0.19521 -0.49044,0.40378 -0.78083,0.62322 -0.0785,0.0597 -0.16832,0.12632 -0.27027,0.19999 l -0.154,0.11265 -9.148793,-4.00131 0.0894,-0.0584 c 0.007,-0.004 0.02228,-0.0155 0.04857,-0.0346 0.123621,-0.0923 0.259794,-0.20319 0.412895,-0.33073 0.607899,-0.50626 1.181468,-1.07062 1.756997,-1.67742 2.328481,-2.45299 4.049011,-5.15919 5.513881,-7.97419 6.46189,-12.41085 6.55496,-25.67394 4.91598,-38.80952 -1.30807,-9.888781 -3.61235,-19.707408 -7.99176,-29.085561 l -15.510171,8.823235 z"
1692
+ }))));
1677
1693
  }
1678
1694
 
1679
- var _path$2;
1695
+ var _g$1;
1680
1696
 
1681
1697
  function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
1682
1698
 
1683
1699
  function SvgNeedle(props) {
1684
1700
  return /*#__PURE__*/createElement("svg", _extends$2({
1685
- width: 287.121,
1686
- height: 887.106,
1687
- viewBox: "0 0 75.967 234.713"
1688
- }, props), _path$2 || (_path$2 = /*#__PURE__*/createElement("path", {
1689
- d: "M37.984 0l37.983 117.357H0zM37.984 234.713l37.983-117.356H0z"
1690
- })));
1701
+ width: "75.967445mm",
1702
+ height: "234.71339mm",
1703
+ viewBox: "0 0 75.967445 234.71339"
1704
+ }, props), _g$1 || (_g$1 = /*#__PURE__*/createElement("g", {
1705
+ transform: "translate(-76.705281,-29.77268)"
1706
+ }, /*#__PURE__*/createElement("path", {
1707
+ d: "m 114.68901,29.77268 37.98372,117.3567 H 76.705281 Z"
1708
+ }), /*#__PURE__*/createElement("path", {
1709
+ d: "m 114.68901,264.48608 37.98372,-117.3567 H 76.705281 Z"
1710
+ }))));
1691
1711
  }
1692
1712
 
1693
1713
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
@@ -1915,6 +1935,12 @@ var MlFollowGps = function MlFollowGps(props) {
1915
1935
  var initializedRef = useRef(false);
1916
1936
  var mapRef = useRef(undefined);
1917
1937
  var componentId = useRef((props.idPrefix ? props.idPrefix : "MlFollowGps-") + v4());
1938
+
1939
+ var _useState7 = useState(30),
1940
+ _useState8 = _slicedToArray(_useState7, 2),
1941
+ accuracyRadius = _useState8[0],
1942
+ setAccuracyRadius = _useState8[1];
1943
+
1918
1944
  useEffect(function () {
1919
1945
  var _componentId = componentId.current;
1920
1946
  return function () {
@@ -1947,6 +1973,7 @@ var MlFollowGps = function MlFollowGps(props) {
1947
1973
  var getLocationSuccess = function getLocationSuccess(pos) {
1948
1974
  if (!mapRef.current) return;
1949
1975
  mapRef.current.setCenter([pos.coords.longitude, pos.coords.latitude]);
1976
+ setAccuracyRadius(pos.coords.accuracy);
1950
1977
  setGeoJson(point([pos.coords.longitude, pos.coords.latitude]));
1951
1978
  };
1952
1979
 
@@ -1959,7 +1986,10 @@ var MlFollowGps = function MlFollowGps(props) {
1959
1986
  geojson: geoJson,
1960
1987
  type: "circle",
1961
1988
  paint: {
1962
- "circle-radius": 30,
1989
+ "circle-radius": {
1990
+ stops: [[0, 0], [20, accuracyRadius / 0.075 / Math.cos(geoJson.geometry.coordinates[1] * Math.PI / 180)]],
1991
+ base: 2
1992
+ },
1963
1993
  "circle-color": "#ee7700",
1964
1994
  "circle-opacity": 0.5
1965
1995
  }