@mapcomponents/react-maplibre 0.1.12 → 0.1.13

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 (120) hide show
  1. package/coverage/clover.xml +727 -608
  2. package/coverage/coverage-final.json +19 -14
  3. package/coverage/lcov-report/index.html +156 -96
  4. package/coverage/lcov-report/{components → src/components}/MapLibreMap/MapLibreMap.js.html +10 -10
  5. package/coverage/lcov-report/{components → src/components}/MapLibreMap/index.html +10 -10
  6. package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.js.html +10 -10
  7. package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/index.html +10 -10
  8. package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/MlFeatureEditor.js.html +10 -10
  9. package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/index.html +10 -10
  10. package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +10 -10
  11. package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/index.html +10 -10
  12. package/coverage/lcov-report/{components → src/components}/MlFollowGps/MlFollowGps.js.html +61 -55
  13. package/coverage/lcov-report/{components → src/components}/MlFollowGps/index.html +10 -10
  14. package/coverage/lcov-report/{components → src/components}/MlGPXViewer/MlGPXViewer.js.html +66 -60
  15. package/coverage/lcov-report/{components → src/components}/MlGPXViewer/gpxConverter.js.html +49 -70
  16. package/coverage/lcov-report/{components → src/components}/MlGPXViewer/index.html +25 -25
  17. package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.js.html +70 -28
  18. package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/index.html +27 -27
  19. package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/MlImageMarkerLayer.js.html +19 -22
  20. package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/index.html +19 -19
  21. package/coverage/lcov-report/{components → src/components}/MlLayer/MlLayer.js.html +30 -30
  22. package/coverage/lcov-report/{components → src/components}/MlLayer/index.html +26 -26
  23. package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/MlLayerMagnify.js.html +41 -41
  24. package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/index.html +24 -24
  25. package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/MlLayerSwipe.js.html +38 -41
  26. package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/index.html +24 -24
  27. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +755 -0
  28. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +380 -0
  29. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +117 -0
  30. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +117 -0
  31. package/coverage/lcov-report/{components → src/components}/MlMarker/MlMarker.js.html +11 -11
  32. package/coverage/lcov-report/{components → src/components}/MlMarker/index.html +10 -10
  33. package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/MlNavigationCompass.js.html +10 -10
  34. package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/index.html +10 -10
  35. package/coverage/lcov-report/{components → src/components}/MlNavigationTools/MlNavigationTools.js.html +48 -36
  36. package/coverage/lcov-report/{components → src/components}/MlNavigationTools/index.html +16 -16
  37. package/coverage/lcov-report/{components → src/components}/MlOsmLayer/MlOsmLayer.js.html +10 -10
  38. package/coverage/lcov-report/{components → src/components}/MlOsmLayer/index.html +10 -10
  39. package/coverage/lcov-report/{components → src/components}/MlScaleReference/MlScaleReference.js.html +10 -10
  40. package/coverage/lcov-report/{components → src/components}/MlScaleReference/index.html +10 -10
  41. package/coverage/lcov-report/{components → src/components}/MlShareMapState/MlShareMapState.js.html +10 -10
  42. package/coverage/lcov-report/{components → src/components}/MlShareMapState/index.html +10 -10
  43. package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +10 -10
  44. package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/index.html +10 -10
  45. package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.js.html +30 -54
  46. package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/index.html +24 -24
  47. package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.js.html +10 -10
  48. package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/index.html +10 -10
  49. package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.js.html +10 -10
  50. package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/index.html +10 -10
  51. package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +10 -10
  52. package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/index.html +10 -10
  53. package/coverage/lcov-report/{components → src/components}/MlWmsLayer/MlWmsLayer.js.html +13 -13
  54. package/coverage/lcov-report/{components → src/components}/MlWmsLayer/index.html +14 -14
  55. package/coverage/lcov-report/{components → src/components}/MlWmsLoader/MlWmsLoader.js.html +31 -19
  56. package/coverage/lcov-report/{components → src/components}/MlWmsLoader/index.html +16 -16
  57. package/coverage/lcov-report/{hooks → src/hooks}/index.html +10 -10
  58. package/coverage/lcov-report/{hooks → src/hooks}/useMap.js.html +10 -10
  59. package/coverage/lcov-report/{hooks → src/hooks}/useMapState.js.html +10 -10
  60. package/coverage/lcov-report/{hooks → src/hooks}/useWms.js.html +18 -18
  61. package/coverage/lcov-report/src/i18n.js.html +167 -0
  62. package/coverage/lcov-report/src/index.html +117 -0
  63. package/coverage/lcov-report/src/translations/english.js.html +95 -0
  64. package/coverage/lcov-report/src/translations/german.js.html +95 -0
  65. package/coverage/lcov-report/src/translations/index.html +132 -0
  66. package/coverage/lcov.info +1240 -976
  67. package/dist/b556faa3bc6829d2.png +0 -0
  68. package/dist/index.esm.js +102 -71
  69. package/dist/index.esm.js.map +1 -1
  70. package/package.json +3 -1
  71. package/public/assets/dop.png +0 -0
  72. package/public/assets/historic.png +0 -0
  73. package/public/assets/osm.png +0 -0
  74. package/public/thumbnails/MlFollowGps.png +0 -0
  75. package/public/thumbnails/MlThreeJsLayer.png +0 -0
  76. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +58 -73
  77. package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -2
  78. package/src/components/MlFollowGps/MlFollowGps.js +45 -43
  79. package/src/components/MlFollowGps/MlFollowGps.meta.json +2 -2
  80. package/src/components/MlFollowGps/assets/marker.png +0 -0
  81. package/src/components/MlGPXViewer/MlGPXViewer.js +45 -43
  82. package/src/components/MlGPXViewer/gpxConverter.js +22 -29
  83. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +22 -8
  84. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +3 -4
  85. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +6 -7
  86. package/src/components/MlLayer/MlLayer.js +2 -2
  87. package/src/components/MlLayer/MlLayer.test.js +12 -10
  88. package/src/components/MlLayerMagnify/MlLayerMagnify.js +3 -3
  89. package/src/components/MlLayerSwipe/MlLayerSwipe.js +4 -5
  90. package/src/components/MlLayerSwitcher/MlLayerSwitcher.css +17 -0
  91. package/src/components/MlLayerSwitcher/MlLayerSwitcher.doc.de.md +3 -0
  92. package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +223 -0
  93. package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +15 -0
  94. package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +106 -0
  95. package/src/components/MlLayerSwitcher/assets/sample_1.json +26 -0
  96. package/src/components/MlLayerSwitcher/assets/sample_2.json +22 -0
  97. package/src/components/MlLayerSwitcher/components/LayerBox.js +98 -0
  98. package/src/components/MlMarker/MlMarker.js +1 -1
  99. package/src/components/MlNavigationTools/MlNavigationTools.js +26 -22
  100. package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -1
  101. package/src/components/MlScaleReference/MlScaleReference.stories.js +25 -21
  102. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +12 -6
  103. package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +8 -15
  104. package/src/components/MlWmsLayer/MlWmsLayer.js +1 -1
  105. package/src/components/MlWmsLoader/MlWmsLoader.js +8 -4
  106. package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -1
  107. package/src/components/MlWmsLoader/MlWmsLoader.stories.js +5 -4
  108. package/src/decorators/EmptyMapContextDecorator.js +11 -6
  109. package/src/decorators/MapContext3DDecorator.js +25 -20
  110. package/src/decorators/MapContextDashboardDecorator.js +7 -2
  111. package/src/decorators/MapContextDecorator.js +7 -3
  112. package/src/decorators/MapContextKlokantechBasicDecorator.js +8 -4
  113. package/src/decorators/MultiMapContextDecorator.js +2 -1
  114. package/src/hooks/useWms.js +7 -6
  115. package/src/i18n.js +28 -0
  116. package/src/translations/english.js +4 -0
  117. package/src/translations/german.js +4 -0
  118. package/src/ui_components/ImageLoader.js +73 -0
  119. package/src/ui_components/Sidebar.js +75 -20
  120. package/src/ui_components/TopToolbar.js +18 -18
Binary file
package/dist/index.esm.js CHANGED
@@ -16,6 +16,7 @@ import GpsFixedIcon from '@mui/icons-material/GpsFixed';
16
16
  import _styled from '@emotion/styled/base';
17
17
  import { css } from '@emotion/css';
18
18
  import RoomIcon from '@mui/icons-material/Room';
19
+ import useMediaQuery from '@mui/material/useMediaQuery';
19
20
  import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
20
21
  import MapboxDraw from '@mapbox/mapbox-gl-draw';
21
22
  import Point from '@mapbox/point-geometry';
@@ -287,7 +288,7 @@ var MapLibreGlWrapper = function MapLibreGlWrapper(props) {
287
288
  on: function on(eventName, handler, options, componentId) {
288
289
  if (!self.eventHandlers[eventName]) return;
289
290
 
290
- if (typeof options === 'string') {
291
+ if (typeof options === "string") {
291
292
  componentId = options;
292
293
  options = {};
293
294
  }
@@ -428,7 +429,7 @@ var MapLibreGlWrapper = function MapLibreGlWrapper(props) {
428
429
  */
429
430
  oldViewportStateString: "{}",
430
431
  getViewport: function getViewport() {
431
- return typeof self.map.getCenter === 'function' ? {
432
+ return typeof self.map.getCenter === "function" ? {
432
433
  center: function (_ref) {
433
434
  var lng = _ref.lng,
434
435
  lat = _ref.lat,
@@ -444,24 +445,8 @@ var MapLibreGlWrapper = function MapLibreGlWrapper(props) {
444
445
  pitch: self.map.getPitch()
445
446
  } : {};
446
447
  },
447
- viewportRefreshEnabled: true,
448
- viewportRefreshWaiting: false,
449
- refreshViewport: function refreshViewport(force) {
450
- if (self.wrapper.viewportRefreshEnabled || force) {
451
- self.wrapper.viewportRefreshEnabled = false;
452
- self.wrapper.viewportState = self.wrapper.getViewport();
453
- self.wrapper.viewportStateString = JSON.stringify(self.wrapper.viewportState);
454
- setTimeout(function () {
455
- self.wrapper.viewportRefreshEnabled = true;
456
-
457
- if (self.wrapper.viewportRefreshWaiting) {
458
- self.wrapper.viewportRefreshWaiting = false;
459
- self.wrapper.refreshViewport();
460
- }
461
- }, 50);
462
- } else {
463
- self.wrapper.viewportRefreshWaiting = true;
464
- }
448
+ refreshViewport: function refreshViewport() {
449
+ self.wrapper.viewportState = self.wrapper.getViewport();
465
450
  }
466
451
  };
467
452
  /**
@@ -738,7 +723,7 @@ var MapLibreGlWrapper = function MapLibreGlWrapper(props) {
738
723
  if (response.ok) {
739
724
  return response.json();
740
725
  } else {
741
- throw new Error('error loading map style.json');
726
+ throw new Error("error loading map style.json");
742
727
  }
743
728
  }).then(function (styleJson) {
744
729
  styleJson.layers.forEach(function (item) {
@@ -757,15 +742,11 @@ var MapLibreGlWrapper = function MapLibreGlWrapper(props) {
757
742
  case 3:
758
743
  self.map = new maplibregl.Map(props.mapOptions);
759
744
  self.addNativeMaplibreFunctionsAndProps();
760
- self.wrapper.refreshViewport(true);
745
+ self.wrapper.refreshViewport();
761
746
  self.wrapper.fire("viewportchange");
762
747
  self.map.on("move", function () {
763
- self.wrapper.refreshViewport();
764
-
765
- if (self.wrapper.viewportStateString !== self.wrapper.oldViewportStateString) {
766
- self.wrapper.oldViewportStateString = self.wrapper.viewportStateString;
767
- self.wrapper.fire("viewportchange");
768
- }
748
+ self.wrapper.viewportState = self.wrapper.getViewport();
749
+ self.wrapper.fire("viewportchange");
769
750
  });
770
751
  self.map.on("data", function () {
771
752
  self.wrapper.refreshLayerState();
@@ -1442,11 +1423,17 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1442
1423
  };
1443
1424
  }, []);
1444
1425
  useEffect(function () {
1445
- if (!mapRef.current || !initializedRef.current) return; // the MapLibre-gl instance (mapContext.map) is accessible here
1446
- // initialize the layer and add it to the MapLibre-gl instance or do something else with it
1426
+ if (!mapRef.current || !initializedRef.current) return;
1427
+
1428
+ for (var key in props.layout) {
1429
+ mapContext.getMap(props.mapId).setLayoutProperty(layerId.current, key, props.layout[key]);
1430
+ }
1431
+ }, [props.layout, mapContext, props.mapId]);
1432
+ useEffect(function () {
1433
+ if (!mapRef.current || !initializedRef.current) return;
1447
1434
 
1448
1435
  for (var key in props.paint) {
1449
- mapContext.getMap(props.mapId).setPaintProperty(componentId.current, key, props.paint[key]);
1436
+ mapContext.getMap(props.mapId).setPaintProperty(layerId.current, key, props.paint[key]);
1450
1437
  }
1451
1438
  }, [props.paint, mapContext, props.mapId]);
1452
1439
  var transitionToGeojson = useCallback(function (newGeojson) {
@@ -1494,7 +1481,8 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
1494
1481
  paint: props.paint || {
1495
1482
  "line-color": "rgb(100,200,100)",
1496
1483
  "line-width": 10
1497
- }
1484
+ },
1485
+ layout: props.layout || {}
1498
1486
  }, props.insertBeforeLayer, componentId.current);
1499
1487
 
1500
1488
  if (typeof props.onHover !== "undefined") {
@@ -1531,8 +1519,17 @@ MlGeoJsonLayer.propTypes = {
1531
1519
  type: PropTypes.string,
1532
1520
 
1533
1521
  /**
1534
- * Paint object, that is passed to the addLayer call.
1535
- * Possible propsdepend on the layer type.
1522
+ * Layout property object, that is passed to the addLayer call.
1523
+ * Possible props depend on the layer type.
1524
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
1525
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
1526
+ * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
1527
+ */
1528
+ layout: PropTypes.object,
1529
+
1530
+ /**
1531
+ * Paint property object, that is passed to the addLayer call.
1532
+ * Possible props depend on the layer type.
1536
1533
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
1537
1534
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
1538
1535
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
@@ -1587,12 +1584,12 @@ MlGeoJsonLayer.propTypes = {
1587
1584
  var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
1588
1585
  // Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
1589
1586
  var mapRef = useRef(null);
1590
- var componentId = useRef((props.idPrefix ? props.idPrefix : "MlOsmLayer-") + v4());
1587
+ var componentId = useRef((props.idPrefix ? props.idPrefix : "MlImageMarkerLayer-") + v4());
1591
1588
  var mapContext = useContext(MapContext);
1592
1589
  var layerInitializedRef = useRef(false);
1593
1590
  var idSuffixRef = useRef(props.idSuffix || new Date().getTime());
1594
1591
  var imageIdRef = useRef(props.imageId || "img_" + new Date().getTime());
1595
- var layerId = useRef((props.layerId || "MlImageMarkerLayer-") + idSuffixRef.current);
1592
+ var layerId = useRef(props.layerId || componentId.current);
1596
1593
  useEffect(function () {
1597
1594
  var _componentId = componentId.current;
1598
1595
  return function () {
@@ -1636,6 +1633,7 @@ var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
1636
1633
 
1637
1634
  mapRef.current = mapContext.getMap(props.mapId);
1638
1635
  layerInitializedRef.current = true;
1636
+ console.log(props.imgSrc);
1639
1637
 
1640
1638
  if (props.imgSrc) {
1641
1639
  mapRef.current.loadImage(props.imgSrc, function (error, image) {
@@ -1901,6 +1899,8 @@ MlNavigationCompass.propTypes = {
1901
1899
  rotateLeftStyle: PropTypes.object
1902
1900
  };
1903
1901
 
1902
+ var marker = "b556faa3bc6829d2.png";
1903
+
1904
1904
  /**
1905
1905
  * Adds a button that makes the map follow the users GPS position using
1906
1906
  * navigator.geolocation.watchPosition if activated
@@ -2005,7 +2005,7 @@ var MlFollowGps = function MlFollowGps(props) {
2005
2005
  "icon-offset": [0, -340]
2006
2006
  }
2007
2007
  },
2008
- imgSrc: "/assets/marker.png"
2008
+ imgSrc: marker
2009
2009
  }), /*#__PURE__*/React__default.createElement(Button, {
2010
2010
  sx: _objectSpread2({
2011
2011
  zIndex: 1002,
@@ -2022,7 +2022,9 @@ var MlFollowGps = function MlFollowGps(props) {
2022
2022
  setIsFollowed(!isFollowed);
2023
2023
  }
2024
2024
  }, " ", /*#__PURE__*/React__default.createElement(RoomIcon, {
2025
- sx: {}
2025
+ sx: {
2026
+ fontSize: props.style.fontSize
2027
+ }
2026
2028
  }), " "));
2027
2029
  };
2028
2030
 
@@ -2036,6 +2038,7 @@ MlFollowGps.defaultProps = {
2036
2038
  backgroundColor: "#414141",
2037
2039
  borderRadius: "23%",
2038
2040
  margin: 0.15,
2041
+ fontSize: "1.3em",
2039
2042
  ":hover": {
2040
2043
  backgroundColor: "#515151",
2041
2044
  color: "#ececec"
@@ -2070,17 +2073,19 @@ var MlNavigationTools = function MlNavigationTools(props) {
2070
2073
  locationAccessDenied = _useState4[0],
2071
2074
  setLocationAccessDenied = _useState4[1];
2072
2075
 
2076
+ var mediaIsMobile = useMediaQuery("(max-width:900px)");
2073
2077
  var buttonStyle = {
2074
- minWidth: "30px",
2075
- minHeight: "30px",
2076
- width: "30px",
2077
- height: "30px",
2078
+ minWidth: "20px",
2079
+ minHeight: "20px",
2080
+ width: mediaIsMobile ? "50px" : "30px",
2081
+ height: mediaIsMobile ? "50px" : "30px",
2078
2082
  color: "#bbb",
2079
2083
  backgroundColor: "#414141",
2080
2084
  borderRadius: "23%",
2081
2085
  //border: "1px solid #bbb",
2082
2086
  //boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
2083
2087
  margin: 0.15,
2088
+ fontSize: mediaIsMobile ? "1.5em" : "1.2em",
2084
2089
  ":hover": {
2085
2090
  backgroundColor: "#515151",
2086
2091
  color: "#ececec"
@@ -2164,8 +2169,8 @@ var MlNavigationTools = function MlNavigationTools(props) {
2164
2169
  style: {
2165
2170
  zIndex: 501,
2166
2171
  position: "absolute",
2167
- right: "20px",
2168
- bottom: "20px",
2172
+ right: mediaIsMobile ? "15px" : "5px",
2173
+ bottom: mediaIsMobile ? "40px" : "20px",
2169
2174
  display: "flex",
2170
2175
  flexDirection: "column"
2171
2176
  }
@@ -2173,15 +2178,15 @@ var MlNavigationTools = function MlNavigationTools(props) {
2173
2178
  style: {
2174
2179
  width: "31px",
2175
2180
  position: "relative",
2176
- height: "50px",
2177
- marginLeft: "-5px"
2181
+ height: mediaIsMobile ? "55px" : "45px",
2182
+ marginLeft: mediaIsMobile ? "3px" : "-5px",
2183
+ transform: mediaIsMobile ? "scale(1.6)" : "scale(1)"
2178
2184
  },
2179
2185
  backgroundStyle: {
2180
2186
  boxShadow: "0px 0px 18px rgba(0,0,0,.5)"
2181
2187
  }
2182
2188
  }), /*#__PURE__*/React__default.createElement(Button, {
2183
2189
  sx: _objectSpread2(_objectSpread2({}, buttonStyle), {}, {
2184
- fontSize: ".9em",
2185
2190
  fontWeight: 600
2186
2191
  }),
2187
2192
  onClick: adjustPitch
@@ -2191,15 +2196,17 @@ var MlNavigationTools = function MlNavigationTools(props) {
2191
2196
  disabled: locationAccessDenied
2192
2197
  }, /*#__PURE__*/React__default.createElement(GpsFixedIcon, {
2193
2198
  sx: {
2194
- width: ".9em"
2199
+ fontSize: mediaIsMobile ? "1.5em" : "1.2em"
2195
2200
  }
2196
- })), /*#__PURE__*/React__default.createElement(MlFollowGps, null), /*#__PURE__*/React__default.createElement(ButtonGroup, {
2201
+ })), /*#__PURE__*/React__default.createElement(MlFollowGps, {
2202
+ style: buttonStyle
2203
+ }), /*#__PURE__*/React__default.createElement(ButtonGroup, {
2197
2204
  orientation: "vertical",
2198
2205
  sx: {
2199
- width: "30px",
2206
+ width: "50px",
2200
2207
  border: "none",
2201
2208
  Button: {
2202
- minWidth: "30px !important",
2209
+ minWidth: "20px !important",
2203
2210
  border: "none",
2204
2211
  padding: 0
2205
2212
  },
@@ -2210,10 +2217,18 @@ var MlNavigationTools = function MlNavigationTools(props) {
2210
2217
  }, /*#__PURE__*/React__default.createElement(Button, {
2211
2218
  sx: buttonStyle,
2212
2219
  onClick: zoomIn
2213
- }, /*#__PURE__*/React__default.createElement(ControlPointIcon, null)), /*#__PURE__*/React__default.createElement(Button, {
2220
+ }, /*#__PURE__*/React__default.createElement(ControlPointIcon, {
2221
+ sx: {
2222
+ fontSize: mediaIsMobile ? "1.5em" : "1.2em"
2223
+ }
2224
+ })), /*#__PURE__*/React__default.createElement(Button, {
2214
2225
  sx: buttonStyle,
2215
2226
  onClick: zoomOut
2216
- }, /*#__PURE__*/React__default.createElement(RemoveCircleOutlineIcon, null))));
2227
+ }, /*#__PURE__*/React__default.createElement(RemoveCircleOutlineIcon, {
2228
+ sx: {
2229
+ fontSize: mediaIsMobile ? "1.5em" : "1.2em"
2230
+ }
2231
+ }))));
2217
2232
  };
2218
2233
 
2219
2234
  var MlLayer = function MlLayer(props) {
@@ -2223,7 +2238,7 @@ var MlLayer = function MlLayer(props) {
2223
2238
  var mapRef = useRef(null);
2224
2239
  var componentId = useRef((props.layerId ? props.layerId : "MlLayer-") + v4());
2225
2240
  var idSuffixRef = useRef(props.idSuffix || new Date().getTime());
2226
- var layerId = (props.layerId || "MlLayer-") + idSuffixRef.current;
2241
+ var layerId = useRef(props.layerId || componentId.current);
2227
2242
  var layerPaintConfRef = useRef(undefined);
2228
2243
  var layerLayoutConfRef = useRef(undefined);
2229
2244
  useEffect(function () {
@@ -2271,7 +2286,7 @@ var MlLayer = function MlLayer(props) {
2271
2286
 
2272
2287
  layerInitializedRef.current = true;
2273
2288
  mapRef.current.addLayer(_objectSpread2({
2274
- id: layerId,
2289
+ id: layerId.current,
2275
2290
  type: "background",
2276
2291
  paint: {
2277
2292
  "background-color": "rgba(0,0,0,0)"
@@ -2537,7 +2552,7 @@ var defaultProps = {
2537
2552
 
2538
2553
  var MlWmsLayer = function MlWmsLayer(props) {
2539
2554
  var mapContext = useContext(MapContext);
2540
- var componentId = useRef((props.idPrefix ? props.idPrefix : "MlWmsLayer-") + v4());
2555
+ var componentId = useRef(props.layerId || "MlWmsLayer-" + v4());
2541
2556
  var mapRef = useRef(null);
2542
2557
  var initializedRef = useRef(false);
2543
2558
  var layerId = useRef(props.layerId || componentId.current);
@@ -4143,7 +4158,7 @@ var MlLayerMagnify = function MlLayerMagnify(props) {
4143
4158
  return false;
4144
4159
  }
4145
4160
 
4146
- if (!mapContext.mapExists(props.map1Id) || !mapContext.mapExists(props.map2Id)) {
4161
+ if (!mapContext.getMap(props.map1Id) || !mapContext.getMap(props.map2Id)) {
4147
4162
  return false;
4148
4163
  }
4149
4164
 
@@ -4188,7 +4203,7 @@ var MlLayerMagnify = function MlLayerMagnify(props) {
4188
4203
  useEffect(function () {
4189
4204
  if (!mapExists() || syncMoveInitializedRef.current) return;
4190
4205
  syncMoveInitializedRef.current = true;
4191
- syncCleanupFunctionRef.current = syncMove(mapContext.getMap(props.map1Id), mapContext.getMap(props.map2Id));
4206
+ syncCleanupFunctionRef.current = syncMove(mapContext.getMap(props.map1Id).map, mapContext.getMap(props.map2Id).map);
4192
4207
 
4193
4208
  if (mapContext.maps[props.map1Id].getCanvas().clientWidth > mapContext.maps[props.map1Id].getCanvas().clientHeight && magnifierRadiusRef.current * 2 > mapContext.maps[props.map1Id].getCanvas().clientHeight) {
4194
4209
  magnifierRadiusRef.current = Math.floor(mapContext.maps[props.map1Id].getCanvas().clientHeight / 2);
@@ -4300,7 +4315,7 @@ var MlLayerSwipe = function MlLayerSwipe(props) {
4300
4315
  return false;
4301
4316
  }
4302
4317
 
4303
- if (!mapContext.mapExists(props.map1Id) || !mapContext.mapExists(props.map2Id)) {
4318
+ if (!mapContext.getMap(props.map1Id) || !mapContext.getMap(props.map2Id)) {
4304
4319
  return false;
4305
4320
  }
4306
4321
 
@@ -4333,7 +4348,7 @@ var MlLayerSwipe = function MlLayerSwipe(props) {
4333
4348
  useEffect(function () {
4334
4349
  if (!mapExists() || initializedRef.current) return;
4335
4350
  initializedRef.current = true;
4336
- syncCleanupFunctionRef.current = syncMove(mapContext.getMap(props.map1Id), mapContext.getMap(props.map2Id));
4351
+ syncCleanupFunctionRef.current = syncMove(mapContext.getMap(props.map1Id).map, mapContext.getMap(props.map2Id).map);
4337
4352
  onMove({
4338
4353
  clientX: mapContext.maps[props.map1Id].getCanvas().clientWidth / 2
4339
4354
  });
@@ -4399,6 +4414,19 @@ MlLayerSwipe.propTypes = {
4399
4414
  var GeoJsonContext = /*#__PURE__*/React__default.createContext({});
4400
4415
  var GeoJsonContextProvider = GeoJsonContext.Provider;
4401
4416
 
4417
+ /**
4418
+ * https://github.com/mapbox/togeojson
4419
+ *
4420
+ * Copyright (c) 2016 Mapbox All rights reserved.
4421
+ *
4422
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4423
+ *
4424
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
4425
+ *
4426
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
4427
+ *
4428
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4429
+ */
4402
4430
  var toGeoJSON = function () {
4403
4431
  var removeSpace = /\s*/g,
4404
4432
  trimSpace = /^\s*|\s*$/g,
@@ -5039,6 +5067,7 @@ var MlGPXViewer = function MlGPXViewer(props) {
5039
5067
  setMetaData = _useState6[1];
5040
5068
 
5041
5069
  var fileupload = useRef(null);
5070
+ var mediaIsMobile = useMediaQuery("(max-width:900px)");
5042
5071
  var popup = useRef(new Popup({
5043
5072
  closeButton: false,
5044
5073
  closeOnClick: true
@@ -5236,14 +5265,20 @@ var MlGPXViewer = function MlGPXViewer(props) {
5236
5265
  fileupload.current.click();
5237
5266
  };
5238
5267
 
5239
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
5240
- onClick: manualUpload,
5268
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
5241
5269
  style: {
5242
- position: "absolute",
5270
+ position: "fixed",
5243
5271
  right: "5px",
5244
- bottom: "75px",
5245
- backgroundColor: "rgba(255,255,255,1)",
5272
+ bottom: mediaIsMobile ? "40px" : "25px",
5273
+ display: "flex",
5274
+ flexDirection: "column",
5275
+ gap: "5px",
5246
5276
  zIndex: 1000
5277
+ }
5278
+ }, /*#__PURE__*/React__default.createElement(IconButton, {
5279
+ onClick: manualUpload,
5280
+ style: {
5281
+ backgroundColor: "rgba(255,255,255,1)"
5247
5282
  },
5248
5283
  size: "large"
5249
5284
  }, /*#__PURE__*/React__default.createElement("input", {
@@ -5258,14 +5293,10 @@ var MlGPXViewer = function MlGPXViewer(props) {
5258
5293
  }), /*#__PURE__*/React__default.createElement(FileCopy, null)), /*#__PURE__*/React__default.createElement(IconButton, {
5259
5294
  onClick: toogleDrawer,
5260
5295
  style: {
5261
- position: "absolute",
5262
- right: "5px",
5263
- bottom: "25px",
5264
- backgroundColor: "rgba(255,255,255,1)",
5265
- zIndex: 1000
5296
+ backgroundColor: "rgba(255,255,255,1)"
5266
5297
  },
5267
5298
  size: "large"
5268
- }, /*#__PURE__*/React__default.createElement(InfoIcon, null)), /*#__PURE__*/React__default.createElement(Drawer, {
5299
+ }, /*#__PURE__*/React__default.createElement(InfoIcon, null))), /*#__PURE__*/React__default.createElement(Drawer, {
5269
5300
  variant: "persistent",
5270
5301
  anchor: "left",
5271
5302
  open: open