@mapcomponents/react-maplibre 0.1.9 → 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.
- package/.github/ISSUE_TEMPLATE/bug_report.md +2 -2
- package/.github/ISSUE_TEMPLATE/feature_request.md +3 -3
- package/.github/workflows/node_version_test.yml +25 -0
- package/.github/workflows/storybook.yml +6 -3
- package/CONTRIBUTING.md +2 -2
- package/README.md +3 -7
- package/coverage/clover.xml +748 -625
- package/coverage/coverage-final.json +19 -14
- package/coverage/lcov-report/block-navigation.js +8 -0
- package/coverage/lcov-report/index.html +170 -104
- package/coverage/lcov-report/sorter.js +26 -0
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/MapLibreMap.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/MlFeatureEditor.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/MlFollowGps.js.html +99 -48
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/index.html +27 -21
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/MlGPXViewer.js.html +73 -61
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/gpxConverter.js.html +56 -71
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/index.html +32 -26
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.js.html +91 -31
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/index.html +35 -29
- package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/MlImageMarkerLayer.js.html +26 -23
- package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/index.html +26 -20
- package/coverage/lcov-report/{components → src/components}/MlLayer/MlLayer.js.html +37 -31
- package/coverage/lcov-report/{components → src/components}/MlLayer/index.html +33 -27
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/MlLayerMagnify.js.html +48 -42
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/index.html +31 -25
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/MlLayerSwipe.js.html +45 -42
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/index.html +31 -25
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +755 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +380 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +117 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +117 -0
- package/coverage/lcov-report/{components → src/components}/MlMarker/MlMarker.js.html +18 -12
- package/coverage/lcov-report/{components → src/components}/MlMarker/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/MlNavigationCompass.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/MlNavigationTools.js.html +55 -37
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/index.html +23 -17
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/MlOsmLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/MlScaleReference.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/MlShareMapState.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.js.html +37 -55
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/index.html +31 -25
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/MlWmsLayer.js.html +20 -14
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/index.html +21 -15
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/MlWmsLoader.js.html +38 -20
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/index.html +23 -17
- package/coverage/lcov-report/{hooks → src/hooks}/index.html +17 -11
- package/coverage/lcov-report/{hooks → src/hooks}/useMap.js.html +17 -11
- package/coverage/lcov-report/{hooks → src/hooks}/useMapState.js.html +17 -11
- package/coverage/lcov-report/{hooks → src/hooks}/useWms.js.html +25 -19
- package/coverage/lcov-report/src/i18n.js.html +167 -0
- package/coverage/lcov-report/src/index.html +117 -0
- package/coverage/lcov-report/src/translations/english.js.html +95 -0
- package/coverage/lcov-report/src/translations/german.js.html +95 -0
- package/coverage/lcov-report/src/translations/index.html +132 -0
- package/coverage/lcov.info +1278 -1010
- package/dist/b556faa3bc6829d2.png +0 -0
- package/dist/index.esm.js +170 -109
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -1
- package/public/assets/dop.png +0 -0
- package/public/assets/historic.png +0 -0
- package/public/assets/osm.png +0 -0
- package/public/thumbnails/MlFollowGps.png +0 -0
- package/public/thumbnails/MlThreeJsLayer.png +0 -0
- package/rollup.config.js +10 -2
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +58 -73
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta.json +1 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -2
- package/src/components/MlFollowGps/MlFollowGps.js +46 -31
- package/src/components/MlFollowGps/MlFollowGps.meta.json +2 -2
- package/src/components/MlFollowGps/assets/marker.png +0 -0
- package/src/components/MlGPXViewer/MlGPXViewer.js +45 -43
- package/src/components/MlGPXViewer/gpxConverter.js +22 -29
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +27 -9
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -1
- package/src/components/MlGeoJsonLayer/util/transitionFunctions.js +19 -12
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +3 -4
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +6 -7
- package/src/components/MlLayer/MlLayer.js +2 -2
- package/src/components/MlLayer/MlLayer.test.js +12 -10
- package/src/components/MlLayerMagnify/MlLayerMagnify.js +3 -3
- package/src/components/MlLayerSwipe/MlLayerSwipe.js +4 -5
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.css +17 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.doc.de.md +3 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +223 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +15 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +106 -0
- package/src/components/MlLayerSwitcher/assets/sample_1.json +26 -0
- package/src/components/MlLayerSwitcher/assets/sample_2.json +22 -0
- package/src/components/MlLayerSwitcher/components/LayerBox.js +98 -0
- package/src/components/MlMarker/MlMarker.js +1 -1
- package/src/components/MlNavigationTools/MlNavigationTools.js +26 -22
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -1
- package/src/components/MlScaleReference/MlScaleReference.stories.js +25 -21
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +12 -6
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +8 -15
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +3 -3
- package/src/components/MlWmsLayer/MlWmsLayer.js +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.js +8 -4
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +5 -4
- package/src/decorators/EmptyMapContextDecorator.js +11 -6
- package/src/decorators/MapContext3DDecorator.js +25 -20
- package/src/decorators/MapContextDashboardDecorator.js +7 -7
- package/src/decorators/MapContextDecorator.js +7 -8
- package/src/decorators/MapContextKlokantechBasicDecorator.js +8 -9
- package/src/decorators/MultiMapContextDecorator.js +2 -6
- package/src/hooks/useMapState.stories.js +7 -2
- package/src/hooks/useWms.js +7 -6
- package/src/i18n.js +28 -0
- package/src/translations/english.js +4 -0
- package/src/translations/german.js +4 -0
- package/src/ui_components/ImageLoader.js +73 -0
- package/src/ui_components/Sidebar.js +76 -22
- 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 ===
|
|
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 ===
|
|
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
|
-
|
|
448
|
-
|
|
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(
|
|
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(
|
|
745
|
+
self.wrapper.refreshViewport();
|
|
761
746
|
self.wrapper.fire("viewportchange");
|
|
762
747
|
self.map.on("move", function () {
|
|
763
|
-
self.wrapper.
|
|
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();
|
|
@@ -1244,18 +1225,25 @@ MlCreatePdfButton.propTypes = {
|
|
|
1244
1225
|
mapId: PropTypes.string
|
|
1245
1226
|
};
|
|
1246
1227
|
|
|
1247
|
-
var _showNextTransitionSegment = function _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep) {
|
|
1228
|
+
var _showNextTransitionSegment = function _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef) {
|
|
1248
1229
|
var _arguments = arguments;
|
|
1249
1230
|
|
|
1250
1231
|
if (typeof map.getSource(layerId) === "undefined" || !transitionInProgressRef.current) {
|
|
1251
|
-
setTimeout(function () {
|
|
1232
|
+
transitionTimeoutRef.current = setTimeout(function () {
|
|
1252
1233
|
return _showNextTransitionSegment.apply(void 0, _toConsumableArray(_arguments));
|
|
1253
1234
|
}, msPerStep);
|
|
1254
1235
|
return;
|
|
1255
1236
|
}
|
|
1256
1237
|
|
|
1257
1238
|
if (typeof transitionGeojsonDataRef.current[currentTransitionStepRef.current] !== "undefined") {
|
|
1239
|
+
var _map$getSource;
|
|
1240
|
+
|
|
1258
1241
|
var newData = currentTransitionStepRef.current + 1 === transitionGeojsonDataRef.current.length ? props.geojson : lineString([].concat(_toConsumableArray(transitionGeojsonCommonDataRef.current), _toConsumableArray(transitionGeojsonDataRef.current[currentTransitionStepRef.current].geometry.coordinates)));
|
|
1242
|
+
|
|
1243
|
+
if (!(map !== null && map !== void 0 && (_map$getSource = map.getSource) !== null && _map$getSource !== void 0 && _map$getSource.call(map, layerId))) {
|
|
1244
|
+
return;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1259
1247
|
map.getSource(layerId).setData(newData);
|
|
1260
1248
|
|
|
1261
1249
|
if (typeof props.onTransitionFrame === "function") {
|
|
@@ -1265,7 +1253,7 @@ var _showNextTransitionSegment = function _showNextTransitionSegment(props, laye
|
|
|
1265
1253
|
currentTransitionStepRef.current++;
|
|
1266
1254
|
|
|
1267
1255
|
if (transitionInProgressRef.current && currentTransitionStepRef.current < transitionGeojsonDataRef.current.length) {
|
|
1268
|
-
setTimeout(function () {
|
|
1256
|
+
transitionTimeoutRef.current = setTimeout(function () {
|
|
1269
1257
|
return _showNextTransitionSegment.apply(void 0, _toConsumableArray(_arguments));
|
|
1270
1258
|
}, msPerStep);
|
|
1271
1259
|
} else {
|
|
@@ -1278,7 +1266,7 @@ var _showNextTransitionSegment = function _showNextTransitionSegment(props, laye
|
|
|
1278
1266
|
}
|
|
1279
1267
|
};
|
|
1280
1268
|
|
|
1281
|
-
var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, map, layerId) {
|
|
1269
|
+
var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, map, layerId, transitionTimeoutRef) {
|
|
1282
1270
|
// create the transition geojson between oldGeojsonRef.current and props.geojson
|
|
1283
1271
|
// create a geojson that contains no common point between the two line features
|
|
1284
1272
|
var transitionCoordinatesShort = [];
|
|
@@ -1361,11 +1349,11 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
|
|
|
1361
1349
|
|
|
1362
1350
|
tmpLinestring = tmpChunks.features[1];
|
|
1363
1351
|
|
|
1364
|
-
for (i =
|
|
1352
|
+
for (i = 0; i < srcTransitionSteps; i++) {
|
|
1365
1353
|
transitionGeojsonDataRef.current.push(tmpLinestring);
|
|
1366
1354
|
|
|
1367
|
-
if (typeof tmpChunks.features[i
|
|
1368
|
-
tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i
|
|
1355
|
+
if (typeof tmpChunks.features[i] !== "undefined") {
|
|
1356
|
+
tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
|
|
1369
1357
|
} else {
|
|
1370
1358
|
transitionGeojsonDataRef.current.push(tmpLinestring);
|
|
1371
1359
|
break;
|
|
@@ -1380,11 +1368,11 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
|
|
|
1380
1368
|
|
|
1381
1369
|
tmpLinestring = tmpChunks.features[1];
|
|
1382
1370
|
|
|
1383
|
-
for (i =
|
|
1371
|
+
for (i = 0; i < targetTransitionSteps; i++) {
|
|
1384
1372
|
transitionGeojsonDataRef.current.push(tmpLinestring);
|
|
1385
1373
|
|
|
1386
|
-
if (typeof tmpChunks.features[i
|
|
1387
|
-
tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i
|
|
1374
|
+
if (typeof tmpChunks.features[i] !== "undefined") {
|
|
1375
|
+
tmpLinestring = lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
|
|
1388
1376
|
} else {
|
|
1389
1377
|
transitionGeojsonDataRef.current.push(tmpLinestring);
|
|
1390
1378
|
break;
|
|
@@ -1395,8 +1383,8 @@ var _transitionToGeojson = function _transitionToGeojson(newGeojson, props, tran
|
|
|
1395
1383
|
transitionGeojsonDataRef.current.push(props.geojson);
|
|
1396
1384
|
currentTransitionStepRef.current = 1;
|
|
1397
1385
|
transitionInProgressRef.current = true;
|
|
1398
|
-
setTimeout(function () {
|
|
1399
|
-
return _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep);
|
|
1386
|
+
transitionTimeoutRef.current = setTimeout(function () {
|
|
1387
|
+
return _showNextTransitionSegment(props, layerId, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef);
|
|
1400
1388
|
}, msPerStep);
|
|
1401
1389
|
};
|
|
1402
1390
|
|
|
@@ -1414,6 +1402,7 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
|
|
|
1414
1402
|
var mapRef = useRef(null);
|
|
1415
1403
|
var initializedRef = useRef(false);
|
|
1416
1404
|
var transitionInProgressRef = useRef(false);
|
|
1405
|
+
var transitionTimeoutRef = useRef(undefined);
|
|
1417
1406
|
var currentTransitionStepRef = useRef(false);
|
|
1418
1407
|
var transitionGeojsonDataRef = useRef([]);
|
|
1419
1408
|
var transitionGeojsonCommonDataRef = useRef([]);
|
|
@@ -1423,6 +1412,10 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
|
|
|
1423
1412
|
var _componentId = componentId.current;
|
|
1424
1413
|
return function () {
|
|
1425
1414
|
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
1415
|
+
if (transitionTimeoutRef.current) {
|
|
1416
|
+
clearTimeout(transitionTimeoutRef.current);
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1426
1419
|
if (mapRef.current) {
|
|
1427
1420
|
mapRef.current.cleanup(_componentId);
|
|
1428
1421
|
mapRef.current = null;
|
|
@@ -1430,15 +1423,21 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
|
|
|
1430
1423
|
};
|
|
1431
1424
|
}, []);
|
|
1432
1425
|
useEffect(function () {
|
|
1433
|
-
if (!mapRef.current || !initializedRef.current) return;
|
|
1434
|
-
|
|
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;
|
|
1435
1434
|
|
|
1436
1435
|
for (var key in props.paint) {
|
|
1437
|
-
mapContext.getMap(props.mapId).setPaintProperty(
|
|
1436
|
+
mapContext.getMap(props.mapId).setPaintProperty(layerId.current, key, props.paint[key]);
|
|
1438
1437
|
}
|
|
1439
1438
|
}, [props.paint, mapContext, props.mapId]);
|
|
1440
1439
|
var transitionToGeojson = useCallback(function (newGeojson) {
|
|
1441
|
-
_transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapRef.current, componentId.current);
|
|
1440
|
+
_transitionToGeojson(newGeojson, props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapRef.current, componentId.current, transitionTimeoutRef);
|
|
1442
1441
|
}, [props]);
|
|
1443
1442
|
useEffect(function () {
|
|
1444
1443
|
var _mapRef$current, _mapRef$current$getSo;
|
|
@@ -1482,7 +1481,8 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
|
|
|
1482
1481
|
paint: props.paint || {
|
|
1483
1482
|
"line-color": "rgb(100,200,100)",
|
|
1484
1483
|
"line-width": 10
|
|
1485
|
-
}
|
|
1484
|
+
},
|
|
1485
|
+
layout: props.layout || {}
|
|
1486
1486
|
}, props.insertBeforeLayer, componentId.current);
|
|
1487
1487
|
|
|
1488
1488
|
if (typeof props.onHover !== "undefined") {
|
|
@@ -1499,9 +1499,7 @@ var MlGeoJsonLayer = function MlGeoJsonLayer(props) {
|
|
|
1499
1499
|
|
|
1500
1500
|
if (props.type === "line" && typeof props.transitionTime !== "undefined" && typeof props.geojson.geometry !== "undefined") {
|
|
1501
1501
|
transitionToGeojson(props.geojson);
|
|
1502
|
-
|
|
1503
|
-
oldGeojsonRef.current = props.geojson;
|
|
1504
|
-
}, props.transitionTime / 2);
|
|
1502
|
+
oldGeojsonRef.current = props.geojson;
|
|
1505
1503
|
}
|
|
1506
1504
|
}
|
|
1507
1505
|
}, [mapContext.mapIds, mapContext, props, transitionToGeojson]);
|
|
@@ -1521,8 +1519,17 @@ MlGeoJsonLayer.propTypes = {
|
|
|
1521
1519
|
type: PropTypes.string,
|
|
1522
1520
|
|
|
1523
1521
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
* Possible
|
|
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.
|
|
1526
1533
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
1527
1534
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
1528
1535
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
@@ -1577,12 +1584,12 @@ MlGeoJsonLayer.propTypes = {
|
|
|
1577
1584
|
var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
|
|
1578
1585
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
1579
1586
|
var mapRef = useRef(null);
|
|
1580
|
-
var componentId = useRef((props.idPrefix ? props.idPrefix : "
|
|
1587
|
+
var componentId = useRef((props.idPrefix ? props.idPrefix : "MlImageMarkerLayer-") + v4());
|
|
1581
1588
|
var mapContext = useContext(MapContext);
|
|
1582
1589
|
var layerInitializedRef = useRef(false);
|
|
1583
1590
|
var idSuffixRef = useRef(props.idSuffix || new Date().getTime());
|
|
1584
1591
|
var imageIdRef = useRef(props.imageId || "img_" + new Date().getTime());
|
|
1585
|
-
var layerId = useRef(
|
|
1592
|
+
var layerId = useRef(props.layerId || componentId.current);
|
|
1586
1593
|
useEffect(function () {
|
|
1587
1594
|
var _componentId = componentId.current;
|
|
1588
1595
|
return function () {
|
|
@@ -1626,6 +1633,7 @@ var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
|
|
|
1626
1633
|
|
|
1627
1634
|
mapRef.current = mapContext.getMap(props.mapId);
|
|
1628
1635
|
layerInitializedRef.current = true;
|
|
1636
|
+
console.log(props.imgSrc);
|
|
1629
1637
|
|
|
1630
1638
|
if (props.imgSrc) {
|
|
1631
1639
|
mapRef.current.loadImage(props.imgSrc, function (error, image) {
|
|
@@ -1648,46 +1656,56 @@ var MlImageMarkerLayer = function MlImageMarkerLayer(props) {
|
|
|
1648
1656
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
|
|
1649
1657
|
};
|
|
1650
1658
|
|
|
1651
|
-
var _path;
|
|
1652
|
-
|
|
1653
1659
|
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
1660
|
|
|
1655
1661
|
function SvgRotateRight(props) {
|
|
1656
1662
|
return /*#__PURE__*/createElement("svg", _extends({
|
|
1657
|
-
width:
|
|
1658
|
-
height:
|
|
1659
|
-
viewBox: "0 0 39.
|
|
1660
|
-
}, props),
|
|
1661
|
-
|
|
1663
|
+
width: "39.675098mm",
|
|
1664
|
+
height: "104.27064mm",
|
|
1665
|
+
viewBox: "0 0 39.675098 104.27064"
|
|
1666
|
+
}, props), /*#__PURE__*/createElement("g", {
|
|
1667
|
+
transform: "translate(-86.019554,-58.032633)"
|
|
1668
|
+
}, /*#__PURE__*/createElement("path", {
|
|
1669
|
+
style: {
|
|
1670
|
+
strokeWidth: 0.744756
|
|
1671
|
+
},
|
|
1672
|
+
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",
|
|
1673
|
+
transform: "scale(0.26458333)"
|
|
1662
1674
|
})));
|
|
1663
1675
|
}
|
|
1664
1676
|
|
|
1665
|
-
var
|
|
1677
|
+
var _g;
|
|
1666
1678
|
|
|
1667
1679
|
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
1680
|
|
|
1669
1681
|
function SvgRotateLeft(props) {
|
|
1670
1682
|
return /*#__PURE__*/createElement("svg", _extends$1({
|
|
1671
|
-
width:
|
|
1672
|
-
height:
|
|
1673
|
-
viewBox: "0 0 39.
|
|
1674
|
-
}, props),
|
|
1675
|
-
|
|
1676
|
-
}
|
|
1683
|
+
width: "39.675098mm",
|
|
1684
|
+
height: "104.27064mm",
|
|
1685
|
+
viewBox: "0 0 39.675098 104.27064"
|
|
1686
|
+
}, props), _g || (_g = /*#__PURE__*/createElement("g", {
|
|
1687
|
+
transform: "translate(-86.019554,-58.032633)"
|
|
1688
|
+
}, /*#__PURE__*/createElement("path", {
|
|
1689
|
+
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"
|
|
1690
|
+
}))));
|
|
1677
1691
|
}
|
|
1678
1692
|
|
|
1679
|
-
var
|
|
1693
|
+
var _g$1;
|
|
1680
1694
|
|
|
1681
1695
|
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
1696
|
|
|
1683
1697
|
function SvgNeedle(props) {
|
|
1684
1698
|
return /*#__PURE__*/createElement("svg", _extends$2({
|
|
1685
|
-
width:
|
|
1686
|
-
height:
|
|
1687
|
-
viewBox: "0 0 75.
|
|
1688
|
-
}, props),
|
|
1689
|
-
|
|
1690
|
-
}
|
|
1699
|
+
width: "75.967445mm",
|
|
1700
|
+
height: "234.71339mm",
|
|
1701
|
+
viewBox: "0 0 75.967445 234.71339"
|
|
1702
|
+
}, props), _g$1 || (_g$1 = /*#__PURE__*/createElement("g", {
|
|
1703
|
+
transform: "translate(-76.705281,-29.77268)"
|
|
1704
|
+
}, /*#__PURE__*/createElement("path", {
|
|
1705
|
+
d: "m 114.68901,29.77268 37.98372,117.3567 H 76.705281 Z"
|
|
1706
|
+
}), /*#__PURE__*/createElement("path", {
|
|
1707
|
+
d: "m 114.68901,264.48608 37.98372,-117.3567 H 76.705281 Z"
|
|
1708
|
+
}))));
|
|
1691
1709
|
}
|
|
1692
1710
|
|
|
1693
1711
|
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)."; }
|
|
@@ -1881,6 +1899,8 @@ MlNavigationCompass.propTypes = {
|
|
|
1881
1899
|
rotateLeftStyle: PropTypes.object
|
|
1882
1900
|
};
|
|
1883
1901
|
|
|
1902
|
+
var marker = "b556faa3bc6829d2.png";
|
|
1903
|
+
|
|
1884
1904
|
/**
|
|
1885
1905
|
* Adds a button that makes the map follow the users GPS position using
|
|
1886
1906
|
* navigator.geolocation.watchPosition if activated
|
|
@@ -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":
|
|
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
|
}
|
|
@@ -1975,7 +2005,7 @@ var MlFollowGps = function MlFollowGps(props) {
|
|
|
1975
2005
|
"icon-offset": [0, -340]
|
|
1976
2006
|
}
|
|
1977
2007
|
},
|
|
1978
|
-
imgSrc:
|
|
2008
|
+
imgSrc: marker
|
|
1979
2009
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
1980
2010
|
sx: _objectSpread2({
|
|
1981
2011
|
zIndex: 1002,
|
|
@@ -1992,7 +2022,9 @@ var MlFollowGps = function MlFollowGps(props) {
|
|
|
1992
2022
|
setIsFollowed(!isFollowed);
|
|
1993
2023
|
}
|
|
1994
2024
|
}, " ", /*#__PURE__*/React__default.createElement(RoomIcon, {
|
|
1995
|
-
sx: {
|
|
2025
|
+
sx: {
|
|
2026
|
+
fontSize: props.style.fontSize
|
|
2027
|
+
}
|
|
1996
2028
|
}), " "));
|
|
1997
2029
|
};
|
|
1998
2030
|
|
|
@@ -2006,6 +2038,7 @@ MlFollowGps.defaultProps = {
|
|
|
2006
2038
|
backgroundColor: "#414141",
|
|
2007
2039
|
borderRadius: "23%",
|
|
2008
2040
|
margin: 0.15,
|
|
2041
|
+
fontSize: "1.3em",
|
|
2009
2042
|
":hover": {
|
|
2010
2043
|
backgroundColor: "#515151",
|
|
2011
2044
|
color: "#ececec"
|
|
@@ -2040,17 +2073,19 @@ var MlNavigationTools = function MlNavigationTools(props) {
|
|
|
2040
2073
|
locationAccessDenied = _useState4[0],
|
|
2041
2074
|
setLocationAccessDenied = _useState4[1];
|
|
2042
2075
|
|
|
2076
|
+
var mediaIsMobile = useMediaQuery("(max-width:900px)");
|
|
2043
2077
|
var buttonStyle = {
|
|
2044
|
-
minWidth: "
|
|
2045
|
-
minHeight: "
|
|
2046
|
-
width: "30px",
|
|
2047
|
-
height: "30px",
|
|
2078
|
+
minWidth: "20px",
|
|
2079
|
+
minHeight: "20px",
|
|
2080
|
+
width: mediaIsMobile ? "50px" : "30px",
|
|
2081
|
+
height: mediaIsMobile ? "50px" : "30px",
|
|
2048
2082
|
color: "#bbb",
|
|
2049
2083
|
backgroundColor: "#414141",
|
|
2050
2084
|
borderRadius: "23%",
|
|
2051
2085
|
//border: "1px solid #bbb",
|
|
2052
2086
|
//boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
|
|
2053
2087
|
margin: 0.15,
|
|
2088
|
+
fontSize: mediaIsMobile ? "1.5em" : "1.2em",
|
|
2054
2089
|
":hover": {
|
|
2055
2090
|
backgroundColor: "#515151",
|
|
2056
2091
|
color: "#ececec"
|
|
@@ -2134,8 +2169,8 @@ var MlNavigationTools = function MlNavigationTools(props) {
|
|
|
2134
2169
|
style: {
|
|
2135
2170
|
zIndex: 501,
|
|
2136
2171
|
position: "absolute",
|
|
2137
|
-
right: "
|
|
2138
|
-
bottom: "20px",
|
|
2172
|
+
right: mediaIsMobile ? "15px" : "5px",
|
|
2173
|
+
bottom: mediaIsMobile ? "40px" : "20px",
|
|
2139
2174
|
display: "flex",
|
|
2140
2175
|
flexDirection: "column"
|
|
2141
2176
|
}
|
|
@@ -2143,15 +2178,15 @@ var MlNavigationTools = function MlNavigationTools(props) {
|
|
|
2143
2178
|
style: {
|
|
2144
2179
|
width: "31px",
|
|
2145
2180
|
position: "relative",
|
|
2146
|
-
height: "
|
|
2147
|
-
marginLeft: "-5px"
|
|
2181
|
+
height: mediaIsMobile ? "55px" : "45px",
|
|
2182
|
+
marginLeft: mediaIsMobile ? "3px" : "-5px",
|
|
2183
|
+
transform: mediaIsMobile ? "scale(1.6)" : "scale(1)"
|
|
2148
2184
|
},
|
|
2149
2185
|
backgroundStyle: {
|
|
2150
2186
|
boxShadow: "0px 0px 18px rgba(0,0,0,.5)"
|
|
2151
2187
|
}
|
|
2152
2188
|
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
2153
2189
|
sx: _objectSpread2(_objectSpread2({}, buttonStyle), {}, {
|
|
2154
|
-
fontSize: ".9em",
|
|
2155
2190
|
fontWeight: 600
|
|
2156
2191
|
}),
|
|
2157
2192
|
onClick: adjustPitch
|
|
@@ -2161,15 +2196,17 @@ var MlNavigationTools = function MlNavigationTools(props) {
|
|
|
2161
2196
|
disabled: locationAccessDenied
|
|
2162
2197
|
}, /*#__PURE__*/React__default.createElement(GpsFixedIcon, {
|
|
2163
2198
|
sx: {
|
|
2164
|
-
|
|
2199
|
+
fontSize: mediaIsMobile ? "1.5em" : "1.2em"
|
|
2165
2200
|
}
|
|
2166
|
-
})), /*#__PURE__*/React__default.createElement(MlFollowGps,
|
|
2201
|
+
})), /*#__PURE__*/React__default.createElement(MlFollowGps, {
|
|
2202
|
+
style: buttonStyle
|
|
2203
|
+
}), /*#__PURE__*/React__default.createElement(ButtonGroup, {
|
|
2167
2204
|
orientation: "vertical",
|
|
2168
2205
|
sx: {
|
|
2169
|
-
width: "
|
|
2206
|
+
width: "50px",
|
|
2170
2207
|
border: "none",
|
|
2171
2208
|
Button: {
|
|
2172
|
-
minWidth: "
|
|
2209
|
+
minWidth: "20px !important",
|
|
2173
2210
|
border: "none",
|
|
2174
2211
|
padding: 0
|
|
2175
2212
|
},
|
|
@@ -2180,10 +2217,18 @@ var MlNavigationTools = function MlNavigationTools(props) {
|
|
|
2180
2217
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
2181
2218
|
sx: buttonStyle,
|
|
2182
2219
|
onClick: zoomIn
|
|
2183
|
-
}, /*#__PURE__*/React__default.createElement(ControlPointIcon,
|
|
2220
|
+
}, /*#__PURE__*/React__default.createElement(ControlPointIcon, {
|
|
2221
|
+
sx: {
|
|
2222
|
+
fontSize: mediaIsMobile ? "1.5em" : "1.2em"
|
|
2223
|
+
}
|
|
2224
|
+
})), /*#__PURE__*/React__default.createElement(Button, {
|
|
2184
2225
|
sx: buttonStyle,
|
|
2185
2226
|
onClick: zoomOut
|
|
2186
|
-
}, /*#__PURE__*/React__default.createElement(RemoveCircleOutlineIcon,
|
|
2227
|
+
}, /*#__PURE__*/React__default.createElement(RemoveCircleOutlineIcon, {
|
|
2228
|
+
sx: {
|
|
2229
|
+
fontSize: mediaIsMobile ? "1.5em" : "1.2em"
|
|
2230
|
+
}
|
|
2231
|
+
}))));
|
|
2187
2232
|
};
|
|
2188
2233
|
|
|
2189
2234
|
var MlLayer = function MlLayer(props) {
|
|
@@ -2193,7 +2238,7 @@ var MlLayer = function MlLayer(props) {
|
|
|
2193
2238
|
var mapRef = useRef(null);
|
|
2194
2239
|
var componentId = useRef((props.layerId ? props.layerId : "MlLayer-") + v4());
|
|
2195
2240
|
var idSuffixRef = useRef(props.idSuffix || new Date().getTime());
|
|
2196
|
-
var layerId = (props.layerId ||
|
|
2241
|
+
var layerId = useRef(props.layerId || componentId.current);
|
|
2197
2242
|
var layerPaintConfRef = useRef(undefined);
|
|
2198
2243
|
var layerLayoutConfRef = useRef(undefined);
|
|
2199
2244
|
useEffect(function () {
|
|
@@ -2241,7 +2286,7 @@ var MlLayer = function MlLayer(props) {
|
|
|
2241
2286
|
|
|
2242
2287
|
layerInitializedRef.current = true;
|
|
2243
2288
|
mapRef.current.addLayer(_objectSpread2({
|
|
2244
|
-
id: layerId,
|
|
2289
|
+
id: layerId.current,
|
|
2245
2290
|
type: "background",
|
|
2246
2291
|
paint: {
|
|
2247
2292
|
"background-color": "rgba(0,0,0,0)"
|
|
@@ -2507,7 +2552,7 @@ var defaultProps = {
|
|
|
2507
2552
|
|
|
2508
2553
|
var MlWmsLayer = function MlWmsLayer(props) {
|
|
2509
2554
|
var mapContext = useContext(MapContext);
|
|
2510
|
-
var componentId = useRef(
|
|
2555
|
+
var componentId = useRef(props.layerId || "MlWmsLayer-" + v4());
|
|
2511
2556
|
var mapRef = useRef(null);
|
|
2512
2557
|
var initializedRef = useRef(false);
|
|
2513
2558
|
var layerId = useRef(props.layerId || componentId.current);
|
|
@@ -4113,7 +4158,7 @@ var MlLayerMagnify = function MlLayerMagnify(props) {
|
|
|
4113
4158
|
return false;
|
|
4114
4159
|
}
|
|
4115
4160
|
|
|
4116
|
-
if (!mapContext.
|
|
4161
|
+
if (!mapContext.getMap(props.map1Id) || !mapContext.getMap(props.map2Id)) {
|
|
4117
4162
|
return false;
|
|
4118
4163
|
}
|
|
4119
4164
|
|
|
@@ -4158,7 +4203,7 @@ var MlLayerMagnify = function MlLayerMagnify(props) {
|
|
|
4158
4203
|
useEffect(function () {
|
|
4159
4204
|
if (!mapExists() || syncMoveInitializedRef.current) return;
|
|
4160
4205
|
syncMoveInitializedRef.current = true;
|
|
4161
|
-
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);
|
|
4162
4207
|
|
|
4163
4208
|
if (mapContext.maps[props.map1Id].getCanvas().clientWidth > mapContext.maps[props.map1Id].getCanvas().clientHeight && magnifierRadiusRef.current * 2 > mapContext.maps[props.map1Id].getCanvas().clientHeight) {
|
|
4164
4209
|
magnifierRadiusRef.current = Math.floor(mapContext.maps[props.map1Id].getCanvas().clientHeight / 2);
|
|
@@ -4270,7 +4315,7 @@ var MlLayerSwipe = function MlLayerSwipe(props) {
|
|
|
4270
4315
|
return false;
|
|
4271
4316
|
}
|
|
4272
4317
|
|
|
4273
|
-
if (!mapContext.
|
|
4318
|
+
if (!mapContext.getMap(props.map1Id) || !mapContext.getMap(props.map2Id)) {
|
|
4274
4319
|
return false;
|
|
4275
4320
|
}
|
|
4276
4321
|
|
|
@@ -4303,7 +4348,7 @@ var MlLayerSwipe = function MlLayerSwipe(props) {
|
|
|
4303
4348
|
useEffect(function () {
|
|
4304
4349
|
if (!mapExists() || initializedRef.current) return;
|
|
4305
4350
|
initializedRef.current = true;
|
|
4306
|
-
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);
|
|
4307
4352
|
onMove({
|
|
4308
4353
|
clientX: mapContext.maps[props.map1Id].getCanvas().clientWidth / 2
|
|
4309
4354
|
});
|
|
@@ -4369,6 +4414,19 @@ MlLayerSwipe.propTypes = {
|
|
|
4369
4414
|
var GeoJsonContext = /*#__PURE__*/React__default.createContext({});
|
|
4370
4415
|
var GeoJsonContextProvider = GeoJsonContext.Provider;
|
|
4371
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
|
+
*/
|
|
4372
4430
|
var toGeoJSON = function () {
|
|
4373
4431
|
var removeSpace = /\s*/g,
|
|
4374
4432
|
trimSpace = /^\s*|\s*$/g,
|
|
@@ -5009,6 +5067,7 @@ var MlGPXViewer = function MlGPXViewer(props) {
|
|
|
5009
5067
|
setMetaData = _useState6[1];
|
|
5010
5068
|
|
|
5011
5069
|
var fileupload = useRef(null);
|
|
5070
|
+
var mediaIsMobile = useMediaQuery("(max-width:900px)");
|
|
5012
5071
|
var popup = useRef(new Popup({
|
|
5013
5072
|
closeButton: false,
|
|
5014
5073
|
closeOnClick: true
|
|
@@ -5206,14 +5265,20 @@ var MlGPXViewer = function MlGPXViewer(props) {
|
|
|
5206
5265
|
fileupload.current.click();
|
|
5207
5266
|
};
|
|
5208
5267
|
|
|
5209
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
5210
|
-
onClick: manualUpload,
|
|
5268
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
5211
5269
|
style: {
|
|
5212
|
-
position: "
|
|
5270
|
+
position: "fixed",
|
|
5213
5271
|
right: "5px",
|
|
5214
|
-
bottom: "
|
|
5215
|
-
|
|
5272
|
+
bottom: mediaIsMobile ? "40px" : "25px",
|
|
5273
|
+
display: "flex",
|
|
5274
|
+
flexDirection: "column",
|
|
5275
|
+
gap: "5px",
|
|
5216
5276
|
zIndex: 1000
|
|
5277
|
+
}
|
|
5278
|
+
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
5279
|
+
onClick: manualUpload,
|
|
5280
|
+
style: {
|
|
5281
|
+
backgroundColor: "rgba(255,255,255,1)"
|
|
5217
5282
|
},
|
|
5218
5283
|
size: "large"
|
|
5219
5284
|
}, /*#__PURE__*/React__default.createElement("input", {
|
|
@@ -5228,14 +5293,10 @@ var MlGPXViewer = function MlGPXViewer(props) {
|
|
|
5228
5293
|
}), /*#__PURE__*/React__default.createElement(FileCopy, null)), /*#__PURE__*/React__default.createElement(IconButton, {
|
|
5229
5294
|
onClick: toogleDrawer,
|
|
5230
5295
|
style: {
|
|
5231
|
-
|
|
5232
|
-
right: "5px",
|
|
5233
|
-
bottom: "25px",
|
|
5234
|
-
backgroundColor: "rgba(255,255,255,1)",
|
|
5235
|
-
zIndex: 1000
|
|
5296
|
+
backgroundColor: "rgba(255,255,255,1)"
|
|
5236
5297
|
},
|
|
5237
5298
|
size: "large"
|
|
5238
|
-
}, /*#__PURE__*/React__default.createElement(InfoIcon, null)), /*#__PURE__*/React__default.createElement(Drawer, {
|
|
5299
|
+
}, /*#__PURE__*/React__default.createElement(InfoIcon, null))), /*#__PURE__*/React__default.createElement(Drawer, {
|
|
5239
5300
|
variant: "persistent",
|
|
5240
5301
|
anchor: "left",
|
|
5241
5302
|
open: open
|