@mapcomponents/react-maplibre 0.1.67 → 0.1.68
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/coverage/clover.xml +172 -174
- package/coverage/coverage-final.json +7 -7
- package/coverage/lcov-report/index.html +38 -38
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +43 -25
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +10 -10
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +30 -51
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +3 -3
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +41 -98
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +15 -15
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGpxViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +41 -113
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreejsLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +22 -10
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +13 -13
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +24 -3
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +2 -2
- package/coverage/lcov-report/src/hooks/useGpx/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useSource.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useWms.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +27 -3
- package/coverage/lcov.info +326 -342
- package/dist/components/MapLibreMap/MapLibreMap.d.ts +3 -3
- package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +2 -0
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +1 -1
- package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +2 -15
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +1 -14
- package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -0
- package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +1 -0
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -0
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/lib/_PdfPreview.d.ts +1 -0
- package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +1 -0
- package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -0
- package/dist/components/MlFollowGps/MlFollowGps.d.ts +5 -23
- package/dist/components/MlFollowGps/MlFollowGps.stories.d.ts +2 -2
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -0
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +1 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +1 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +1 -0
- package/dist/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +4 -1
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +1 -0
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +1 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +1 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +1 -0
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +1 -0
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +1 -0
- package/dist/components/MlLayer/MlLayer.d.ts +1 -0
- package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +1 -0
- package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +1 -0
- package/dist/components/MlMarker/MlMarker.d.ts +1 -0
- package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +1 -0
- package/dist/components/MlNavigationCompass/MlNavigationCompass.d.ts +1 -0
- package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +5 -0
- package/dist/components/MlScaleReference/MlScaleReference.d.ts +1 -0
- package/dist/components/MlShareMapState/MlShareMapState.d.ts +1 -0
- package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +1 -0
- package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +1 -0
- package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +1 -0
- package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +1 -0
- package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +1 -0
- package/dist/components/MlSketchTool/MlSketchTool.d.ts +1 -0
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +1 -0
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +1 -0
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +1 -0
- package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +1 -0
- package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +1 -0
- package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +1 -0
- package/dist/components/MlVectorTileLayer/MlVectorTileLayer.d.ts +3 -2
- package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +1 -0
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +1 -0
- package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +1 -0
- package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +1 -0
- package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +1 -0
- package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +1 -0
- package/dist/decorators/EmptyMapDecorator.d.ts +2 -0
- package/dist/decorators/ThemeDecorator.d.ts +2 -0
- package/dist/hooks/useCameraFollowPath/useCameraFollowPath.stories.d.ts +1 -0
- package/dist/hooks/useExportMap/lib.d.ts +1 -1
- package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +1 -0
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.esm.css +0 -97
- package/dist/index.esm.js +5495 -14503
- package/dist/index.esm.js.map +1 -1
- package/dist/ui_components/Dropzone.d.ts +1 -0
- package/dist/ui_components/ImageLoader.d.ts +1 -0
- package/dist/ui_components/LayerList/LayerList.d.ts +6 -0
- package/dist/ui_components/LayerList/LayerList.stories.d.ts +12 -0
- package/dist/ui_components/LayerList/LayerListFolder.d.ts +9 -0
- package/dist/ui_components/LayerList/LayerListItem.d.ts +18 -0
- package/dist/ui_components/LayerList/util/LayerListItemVectorLayer.d.ts +15 -0
- package/dist/ui_components/LayerList/util/LayerPropertyForm.d.ts +10 -0
- package/dist/ui_components/LayerList/util/input/ColorPicker.d.ts +10 -0
- package/dist/ui_components/LoadingOverlayContext.d.ts +0 -1
- package/dist/ui_components/MapcomponentsTheme.d.ts +7 -0
- package/dist/ui_components/Tooltip.d.ts +1 -0
- package/dist/ui_components/TopToolbar.d.ts +1 -0
- package/dist/ui_components/UploadButton.d.ts +1 -0
- package/dist/util/Instructions.d.ts +1 -0
- package/package.json +24 -31
- package/rollup.config.js +61 -44
- package/src/@types/assets/index.d.ts +1 -1
- package/src/App.css +0 -55
- package/src/components/MapLibreMap/MapLibreMap.stories.js +36 -37
- package/src/components/MapLibreMap/MapLibreMap.tsx +23 -17
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +1 -1
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +22 -29
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +6 -6
- package/src/components/MlFollowGps/MlFollowGps.stories.js +28 -10
- package/src/components/MlFollowGps/MlFollowGps.tsx +31 -50
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +1 -1
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +16 -10
- package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +4 -13
- package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +3 -1
- package/src/components/MlNavigationTools/MlNavigationTools.stories.js +4 -5
- package/src/components/MlNavigationTools/MlNavigationTools.tsx +30 -54
- package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +1 -1
- package/src/components/MlSketchTool/MlSketchTool.tsx +1 -1
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +7 -3
- package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +3 -11
- package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +2 -2
- package/src/components/MlWmsLoader/utils/WMSLinks.tsx +1 -1
- package/src/contexts/MapContext.tsx +8 -1
- package/src/custom.d.ts +4 -5
- package/src/decorators/EmptyMapDecorator.js +38 -0
- package/src/decorators/MapContextDecorator.js +10 -16
- package/src/decorators/MapContextDecoratorHooks.js +25 -30
- package/src/decorators/MultiMapContextDecorator.js +8 -18
- package/src/decorators/NoNavToolsDecorator.js +8 -15
- package/src/decorators/ThemeDecorator.js +24 -0
- package/src/decorators/style.css +0 -2
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.stories.tsx +13 -19
- package/src/hooks/useExportMap/lib.ts +1 -1
- package/src/hooks/useGpx/useGpx.stories.js +1 -1
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +1 -1
- package/src/hooks/useMapState.stories.js +1 -1
- package/src/hooks/useSources.stories.js +1 -1
- package/src/index.ts +9 -0
- package/src/ui_components/LayerList/LayerList.stories.tsx +136 -0
- package/src/ui_components/LayerList/LayerList.tsx +12 -0
- package/src/ui_components/LayerList/LayerListFolder.tsx +82 -0
- package/src/ui_components/LayerList/LayerListItem.tsx +180 -0
- package/src/ui_components/LayerList/assets/sample_1.json +26 -0
- package/src/ui_components/LayerList/assets/sample_2.json +22 -0
- package/src/ui_components/LayerList/assets/sample_polygon_1.json +33 -0
- package/src/ui_components/LayerList/assets/style.json +2599 -0
- package/src/ui_components/LayerList/util/LayerListItemVectorLayer.tsx +92 -0
- package/src/ui_components/LayerList/util/LayerPropertyForm.tsx +125 -0
- package/src/ui_components/LayerList/util/input/ColorPicker.tsx +44 -0
- package/src/ui_components/MapcomponentsTheme.tsx +133 -0
- package/src/ui_components/Sidebar.tsx +16 -11
- package/src/ui_components/TopToolbar.tsx +1 -3
- package/src/util/BubbleForInstructions.js +14 -12
- package/tsconfig.json +3 -10
- package/dist/components/MlGPXViewer/MlGPXViewer.d.ts +0 -29
- package/dist/components/MlGPXViewer/MlGPXViewer.stories.d.ts +0 -16
- package/dist/components/MlGPXViewer/MlGPXViewer.test.d.ts +0 -1
- package/dist/components/MlGPXViewer/gpxConverter.d.ts +0 -11
- package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +0 -10
- package/dist/components/MlGPXViewer/util/GeoJsonProvider.d.ts +0 -4
- package/dist/components/MlLayer/MlLayer.stories.d.ts +0 -10
- package/dist/custom.d.d.ts +0 -22
- package/dist/decorators/ThemeWrapper.d.ts +0 -1
- package/dist/hooks/exportMap/index.d.ts +0 -11
- package/dist/hooks/exportMap/lib.d.ts +0 -36
- package/dist/ui_components/Legend.d.ts +0 -1
- package/dist/ui_components/LoadingOverlay.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useCallback } from "react";
|
|
2
2
|
import useMap from "../../hooks/useMap";
|
|
3
|
-
import { Button, SxProps, Theme } from
|
|
4
|
-
import
|
|
3
|
+
import { Button, SxProps, Theme } from '@mui/material';
|
|
4
|
+
import GpsFixedIcon from '@mui/icons-material/GpsFixed';
|
|
5
5
|
|
|
6
6
|
export interface MlCenterPositionProps {
|
|
7
7
|
/**
|
|
@@ -36,51 +36,44 @@ const MlCenterPosition = (props: MlCenterPositionProps) => {
|
|
|
36
36
|
mapId: props.mapId,
|
|
37
37
|
waitForLayer: props.insertBeforeLayer,
|
|
38
38
|
});
|
|
39
|
+
|
|
39
40
|
const [locationAccessDenied, setLocationAccessDenied] = useState(false);
|
|
40
41
|
|
|
41
42
|
const centerCurrentLocation = () => {
|
|
42
43
|
navigator.geolocation.getCurrentPosition(getLocationSuccess, getLocationError);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
const getLocationSuccess = useCallback(
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const getLocationSuccess = useCallback(
|
|
47
|
+
(location: GeolocationPosition) => {
|
|
48
|
+
mapHook.map?.map.setCenter?.([location.coords.longitude, location.coords.latitude]);
|
|
49
|
+
},
|
|
50
|
+
[mapHook.map]
|
|
51
|
+
);
|
|
48
52
|
|
|
49
53
|
const getLocationError = () => {
|
|
50
|
-
console.log(
|
|
54
|
+
console.log('Access of user location denied');
|
|
51
55
|
setLocationAccessDenied(true);
|
|
52
56
|
};
|
|
53
|
-
return
|
|
54
|
-
|
|
57
|
+
return (
|
|
58
|
+
<>
|
|
59
|
+
<Button
|
|
60
|
+
variant="navtools"
|
|
55
61
|
sx={{
|
|
56
62
|
zIndex: 1002,
|
|
57
63
|
color: !locationAccessDenied ? props.onColor : props.offColor,
|
|
58
|
-
...props.style,
|
|
59
64
|
}}
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
onClick={centerCurrentLocation}
|
|
66
|
+
disabled={locationAccessDenied}
|
|
67
|
+
>
|
|
68
|
+
<GpsFixedIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
|
|
62
69
|
</Button>
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
MlCenterPosition.defaultProps = {
|
|
68
75
|
mapId: undefined,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
minHeight: "30px",
|
|
72
|
-
width: "30px",
|
|
73
|
-
height: "30px",
|
|
74
|
-
backgroundColor: "#414141",
|
|
75
|
-
borderRadius: "23%",
|
|
76
|
-
margin: 0.15,
|
|
77
|
-
fontSize: "1.3em",
|
|
78
|
-
":hover": {
|
|
79
|
-
backgroundColor: "#515151",
|
|
80
|
-
color: "#ececec",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
onColor: "#ececec",
|
|
84
|
-
offColor: "#666",
|
|
76
|
+
onColor: '#ececec',
|
|
77
|
+
offColor: '#666',
|
|
85
78
|
};
|
|
86
79
|
export default MlCenterPosition;
|
|
@@ -188,7 +188,7 @@ export default function PdfForm(props: PdfFormProps) {
|
|
|
188
188
|
<Select
|
|
189
189
|
labelId="quality-select-label"
|
|
190
190
|
id="quality-select"
|
|
191
|
-
label="
|
|
191
|
+
label="Quality"
|
|
192
192
|
value={pdfContext.quality}
|
|
193
193
|
onChange={(event) => {
|
|
194
194
|
pdfContext.setQuality?.(event.target.value);
|
|
@@ -202,11 +202,11 @@ export default function PdfForm(props: PdfFormProps) {
|
|
|
202
202
|
</Select>
|
|
203
203
|
</FormControl>
|
|
204
204
|
<FormControl fullWidth sx={formControlStyles}>
|
|
205
|
-
<InputLabel id="
|
|
205
|
+
<InputLabel id="scale-select-label">Scale</InputLabel>
|
|
206
206
|
<Select
|
|
207
|
-
labelId="
|
|
208
|
-
id="
|
|
209
|
-
label="
|
|
207
|
+
labelId="scale-select-label"
|
|
208
|
+
id="scale-select"
|
|
209
|
+
label="Scale"
|
|
210
210
|
value={pdfContext?.options?.fixedScale}
|
|
211
211
|
onChange={(event) => {
|
|
212
212
|
pdfContext.setOptions?.((val) => ({
|
|
@@ -229,7 +229,7 @@ export default function PdfForm(props: PdfFormProps) {
|
|
|
229
229
|
onClick={createPdfHandler}
|
|
230
230
|
disabled={loading}
|
|
231
231
|
>
|
|
232
|
-
PDF
|
|
232
|
+
create PDF
|
|
233
233
|
</Button>
|
|
234
234
|
{loading && (
|
|
235
235
|
<CircularProgress
|
|
@@ -1,22 +1,40 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import MlFollowGps from
|
|
3
|
+
import MlFollowGps from './MlFollowGps';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import noNavToolsDecorator from '../../decorators/NoNavToolsDecorator';
|
|
6
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
6
7
|
|
|
7
8
|
const storyoptions = {
|
|
8
|
-
title:
|
|
9
|
+
title: 'MapComponents/MlFollowGps',
|
|
9
10
|
component: MlFollowGps,
|
|
10
|
-
argTypes: {
|
|
11
|
-
|
|
12
|
-
decorators: mapContextDecorator,
|
|
11
|
+
argTypes: {},
|
|
12
|
+
decorators: noNavToolsDecorator,
|
|
13
13
|
};
|
|
14
14
|
export default storyoptions;
|
|
15
15
|
|
|
16
|
-
const Template = (props) =>
|
|
17
|
-
|
|
16
|
+
const Template = (props) => {
|
|
17
|
+
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
position: 'fixed',
|
|
23
|
+
right: '11px',
|
|
24
|
+
bottom: mediaIsMobile ? '130px' : '45px',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
gap: '5px',
|
|
28
|
+
zIndex: 1000,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
<MlFollowGps {...props} />
|
|
32
|
+
</div>
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
18
36
|
export const ExampleConfig = Template.bind({});
|
|
19
37
|
ExampleConfig.parameters = {};
|
|
20
38
|
ExampleConfig.args = {
|
|
21
|
-
followUserPosition: false
|
|
39
|
+
followUserPosition: false,
|
|
22
40
|
};
|
|
@@ -2,11 +2,11 @@ import React, { useRef, useEffect, useState, useCallback, useMemo } from "react"
|
|
|
2
2
|
import useMap from "../../hooks/useMap";
|
|
3
3
|
import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
|
|
4
4
|
|
|
5
|
-
import { Button
|
|
6
|
-
import GpsFixedIcon from
|
|
5
|
+
import { Button } from '@mui/material';
|
|
6
|
+
import GpsFixedIcon from '@mui/icons-material/GpsFixed';
|
|
7
7
|
|
|
8
|
-
import { point, circle, lineArc, Feature, Point } from
|
|
9
|
-
import { CircleLayerSpecification, FillLayerSpecification } from
|
|
8
|
+
import { point, circle, lineArc, Feature, Point } from '@turf/turf';
|
|
9
|
+
import { CircleLayerSpecification, FillLayerSpecification } from 'maplibre-gl';
|
|
10
10
|
|
|
11
11
|
interface MlFollowGpsProps {
|
|
12
12
|
/**
|
|
@@ -47,13 +47,13 @@ interface MlFollowGpsProps {
|
|
|
47
47
|
* Use any available paint prop from layer type "fill".
|
|
48
48
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
49
49
|
*/
|
|
50
|
-
orientationConePaint?: FillLayerSpecification[
|
|
50
|
+
orientationConePaint?: FillLayerSpecification['paint'];
|
|
51
51
|
/**
|
|
52
52
|
* Position circle paint property object, that is passed to the MlGeoJsonLayer responsible for drawing the position circle.
|
|
53
53
|
* Use any available paint prop from layer type "circle".
|
|
54
54
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
55
55
|
*/
|
|
56
|
-
circlePaint?: CircleLayerSpecification[
|
|
56
|
+
circlePaint?: CircleLayerSpecification['paint'];
|
|
57
57
|
/**
|
|
58
58
|
* Active button font color
|
|
59
59
|
*/
|
|
@@ -67,11 +67,7 @@ interface MlFollowGpsProps {
|
|
|
67
67
|
* Use any available paint prop from layer type "fill".
|
|
68
68
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
69
69
|
*/
|
|
70
|
-
accuracyPaint?: FillLayerSpecification[
|
|
71
|
-
/**
|
|
72
|
-
* CSS style object that is applied to the button component
|
|
73
|
-
*/
|
|
74
|
-
buttonSx?: SxProps | any;
|
|
70
|
+
accuracyPaint?: FillLayerSpecification['paint'];
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
/**
|
|
@@ -93,7 +89,7 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
93
89
|
const initiallyCentered = useRef(false);
|
|
94
90
|
|
|
95
91
|
const getLocationSuccess = useCallback(
|
|
96
|
-
(pos:GeolocationPosition) => {
|
|
92
|
+
(pos: GeolocationPosition) => {
|
|
97
93
|
if (!mapHook.map) return;
|
|
98
94
|
|
|
99
95
|
if ((!props.centerUserPosition && !initiallyCentered.current) || props.centerUserPosition) {
|
|
@@ -119,7 +115,7 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
119
115
|
);
|
|
120
116
|
|
|
121
117
|
const getLocationError = () => {
|
|
122
|
-
console.log(
|
|
118
|
+
console.log('Access of user location denied');
|
|
123
119
|
setLocationAccessDenied(true);
|
|
124
120
|
};
|
|
125
121
|
|
|
@@ -138,16 +134,18 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
138
134
|
return copy;
|
|
139
135
|
}, [deviceOrientation, userLocationGeoJson]);
|
|
140
136
|
|
|
141
|
-
const handleOrientation = (event:
|
|
142
|
-
|
|
137
|
+
const handleOrientation = (event: DeviceOrientationEvent) => {
|
|
138
|
+
if (event?.alpha) {
|
|
139
|
+
setDeviceOrientation(-event.alpha);
|
|
140
|
+
}
|
|
143
141
|
};
|
|
144
142
|
|
|
145
143
|
useEffect(() => {
|
|
146
144
|
if (isFollowed) {
|
|
147
145
|
const _handleOrientation = handleOrientation;
|
|
148
|
-
window.addEventListener(
|
|
146
|
+
window.addEventListener('deviceorientation', _handleOrientation);
|
|
149
147
|
return () => {
|
|
150
|
-
window.removeEventListener(
|
|
148
|
+
window.removeEventListener('deviceorientation', _handleOrientation);
|
|
151
149
|
};
|
|
152
150
|
} else {
|
|
153
151
|
initiallyCentered.current = false;
|
|
@@ -173,10 +171,10 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
173
171
|
{isFollowed && userLocationGeoJson && (
|
|
174
172
|
<MlGeoJsonLayer
|
|
175
173
|
geojson={accuracyGeoJson}
|
|
176
|
-
type={
|
|
174
|
+
type={'fill'}
|
|
177
175
|
paint={{
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
'fill-color': '#cbd300',
|
|
177
|
+
'fill-opacity': 0.3,
|
|
180
178
|
...props.accuracyPaint,
|
|
181
179
|
}}
|
|
182
180
|
insertBeforeLayer={props.insertBeforeLayer}
|
|
@@ -186,11 +184,11 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
186
184
|
{isFollowed && orientationCone && (
|
|
187
185
|
<MlGeoJsonLayer
|
|
188
186
|
geojson={orientationCone}
|
|
189
|
-
type={
|
|
187
|
+
type={'fill'}
|
|
190
188
|
paint={{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
'fill-color': '#0000ff',
|
|
190
|
+
'fill-antialias': false,
|
|
191
|
+
'fill-opacity': 0.3,
|
|
194
192
|
...props.orientationConePaint,
|
|
195
193
|
}}
|
|
196
194
|
insertBeforeLayer={props.insertBeforeLayer}
|
|
@@ -200,12 +198,12 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
200
198
|
{isFollowed && userLocationGeoJson && (
|
|
201
199
|
<MlGeoJsonLayer
|
|
202
200
|
geojson={userLocationGeoJson}
|
|
203
|
-
type={
|
|
201
|
+
type={'circle'}
|
|
204
202
|
paint={{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
'circle-color': '#009ee0',
|
|
204
|
+
'circle-radius': 5,
|
|
205
|
+
'circle-stroke-color': '#fafaff',
|
|
206
|
+
'circle-stroke-width': 1,
|
|
209
207
|
...props.circlePaint,
|
|
210
208
|
}}
|
|
211
209
|
insertBeforeLayer={props.insertBeforeLayer}
|
|
@@ -213,20 +211,17 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
213
211
|
)}
|
|
214
212
|
|
|
215
213
|
<Button
|
|
214
|
+
variant="navtools"
|
|
216
215
|
sx={{
|
|
217
216
|
zIndex: 1002,
|
|
218
217
|
color: isFollowed ? props.onColor : props.offColor,
|
|
219
|
-
...props.buttonSx,
|
|
220
218
|
}}
|
|
221
219
|
disabled={locationAccessDenied}
|
|
222
220
|
onClick={() => {
|
|
223
221
|
setIsFollowed(!isFollowed);
|
|
224
222
|
}}
|
|
225
223
|
>
|
|
226
|
-
{
|
|
227
|
-
<GpsFixedIcon
|
|
228
|
-
sx={{ ...(props.buttonSx?.fontSize ? { fontSize: props.buttonSx?.fontSize } : {}) }}
|
|
229
|
-
/>{" "}
|
|
224
|
+
<GpsFixedIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
|
|
230
225
|
</Button>
|
|
231
226
|
</>
|
|
232
227
|
);
|
|
@@ -234,22 +229,8 @@ const MlFollowGps = (props: MlFollowGpsProps) => {
|
|
|
234
229
|
|
|
235
230
|
MlFollowGps.defaultProps = {
|
|
236
231
|
mapId: undefined,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
minHeight: "30px",
|
|
240
|
-
width: "30px",
|
|
241
|
-
height: "30px",
|
|
242
|
-
backgroundColor: "#414141",
|
|
243
|
-
borderRadius: "23%",
|
|
244
|
-
margin: 0.15,
|
|
245
|
-
fontSize: "1.3em",
|
|
246
|
-
":hover": {
|
|
247
|
-
backgroundColor: "#515151",
|
|
248
|
-
color: "#ececec",
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
onColor: "#ececec",
|
|
252
|
-
offColor: "#666",
|
|
232
|
+
onColor: '#ececec',
|
|
233
|
+
offColor: '#666',
|
|
253
234
|
showAccuracyCircle: true,
|
|
254
235
|
showUserLocation: true,
|
|
255
236
|
showOrientation: true,
|
|
@@ -115,7 +115,7 @@ const MlGeoJsonLayer = (props: MlGeoJsonLayerProps) => {
|
|
|
115
115
|
layout: props.layout || {},
|
|
116
116
|
...props.options,
|
|
117
117
|
type: layerType as LayerSpecification['type'],
|
|
118
|
-
}
|
|
118
|
+
} as Partial<LayerSpecification>,
|
|
119
119
|
insertBeforeLayer: props.insertBeforeLayer,
|
|
120
120
|
onHover: props.onHover,
|
|
121
121
|
onClick: props.onClick,
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
import { LayerSpecification, RasterLayerSpecification } from 'maplibre-gl';
|
|
2
|
+
|
|
3
|
+
const getDefaultPaintPropsByType = (
|
|
4
|
+
type: string,
|
|
5
|
+
defaultPaintOverrides?: { [key: string]: unknown }
|
|
6
|
+
): Exclude<LayerSpecification['paint'], RasterLayerSpecification['paint']> => {
|
|
2
7
|
switch (type) {
|
|
3
|
-
case
|
|
8
|
+
case 'fill':
|
|
4
9
|
if (defaultPaintOverrides?.fill) {
|
|
5
10
|
return defaultPaintOverrides.fill;
|
|
6
11
|
}
|
|
7
12
|
return {
|
|
8
|
-
|
|
13
|
+
'fill-color': 'rgba(10,240,256,0.6)',
|
|
9
14
|
};
|
|
10
|
-
case
|
|
15
|
+
case 'line':
|
|
11
16
|
if (defaultPaintOverrides?.line) {
|
|
12
17
|
return defaultPaintOverrides.line;
|
|
13
18
|
}
|
|
14
19
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
'line-color': 'rgb(203,211,2)',
|
|
21
|
+
'line-width': 5,
|
|
22
|
+
'line-blur': 0,
|
|
17
23
|
};
|
|
18
|
-
case
|
|
24
|
+
case 'circle':
|
|
19
25
|
default:
|
|
20
26
|
if (defaultPaintOverrides?.circle) {
|
|
21
27
|
return defaultPaintOverrides.circle;
|
|
22
28
|
}
|
|
23
29
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
'circle-color': 'rgba(10,240,256,0.8)',
|
|
31
|
+
'circle-stroke-color': '#fff',
|
|
32
|
+
'circle-stroke-width': 2,
|
|
27
33
|
};
|
|
28
34
|
}
|
|
29
35
|
};
|
|
@@ -47,8 +47,8 @@ const Template = () => {
|
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
49
|
<>
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
<MlGpxViewerInstructions open={guide} />
|
|
51
|
+
<MlGpxDemoLoader open={demoLoaderOpen} setOpen={setDemoLoaderOpen} setGpx={setGpxData} />
|
|
52
52
|
<TopToolbar appBarStyle={{ zIndex: 500 }}>
|
|
53
53
|
<Button variant="contained" onClick={handleClick2} sx={{ marginRight: '10px' }}>
|
|
54
54
|
Guide me through
|
|
@@ -57,8 +57,7 @@ const Template = () => {
|
|
|
57
57
|
Demo Mode
|
|
58
58
|
</Button>
|
|
59
59
|
</TopToolbar>
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
62
61
|
<div
|
|
63
62
|
style={{
|
|
64
63
|
position: 'fixed',
|
|
@@ -73,12 +72,7 @@ const Template = () => {
|
|
|
73
72
|
<UploadButton
|
|
74
73
|
setData={setGpxData}
|
|
75
74
|
buttonComponent={
|
|
76
|
-
<IconButton
|
|
77
|
-
style={{
|
|
78
|
-
backgroundColor: 'rgba(255,255,255,1)',
|
|
79
|
-
}}
|
|
80
|
-
size="large"
|
|
81
|
-
>
|
|
75
|
+
<IconButton size="large">
|
|
82
76
|
<FileCopy />
|
|
83
77
|
</IconButton>
|
|
84
78
|
}
|
|
@@ -87,9 +81,6 @@ const Template = () => {
|
|
|
87
81
|
onClick={() => {
|
|
88
82
|
setMetadataDrawerOpen((prevState) => !prevState);
|
|
89
83
|
}}
|
|
90
|
-
style={{
|
|
91
|
-
backgroundColor: 'rgba(255,255,255,1)',
|
|
92
|
-
}}
|
|
93
84
|
size="large"
|
|
94
85
|
>
|
|
95
86
|
<InfoIcon />
|
|
@@ -19,6 +19,7 @@ const modalStyle = {
|
|
|
19
19
|
width: 350,
|
|
20
20
|
height: 280,
|
|
21
21
|
bgcolor: 'background.paper',
|
|
22
|
+
color: 'text.primary',
|
|
22
23
|
boxShadow: 24,
|
|
23
24
|
p: 4,
|
|
24
25
|
};
|
|
@@ -30,6 +31,7 @@ const mobileStyle = {
|
|
|
30
31
|
width: 200,
|
|
31
32
|
height: 300,
|
|
32
33
|
bgcolor: 'background.paper',
|
|
34
|
+
color: 'text.primary',
|
|
33
35
|
boxShadow: 24,
|
|
34
36
|
p: 4,
|
|
35
37
|
};
|
|
@@ -101,7 +103,7 @@ const MlGpxDemoLoader = (props: MlGpxDemoLoaderProps) => {
|
|
|
101
103
|
</Grid>
|
|
102
104
|
<Grid item xs={2}>
|
|
103
105
|
<Button onClick={handleClose}>
|
|
104
|
-
<CloseIcon sx={{ color: '
|
|
106
|
+
<CloseIcon sx={{ color: 'text.primary' }} />
|
|
105
107
|
</Button>
|
|
106
108
|
</Grid>
|
|
107
109
|
</Grid>
|
|
@@ -7,7 +7,7 @@ import BuildIcon from "@mui/icons-material/Build";
|
|
|
7
7
|
import Button from "@mui/material/Button";
|
|
8
8
|
|
|
9
9
|
const storyoptions = {
|
|
10
|
-
title:
|
|
10
|
+
title: 'MapComponents/MlNavigationTools',
|
|
11
11
|
component: MlNavigationTools,
|
|
12
12
|
argTypes: {
|
|
13
13
|
url: {},
|
|
@@ -18,7 +18,6 @@ const storyoptions = {
|
|
|
18
18
|
export default storyoptions;
|
|
19
19
|
|
|
20
20
|
const Template = (args) => <MlNavigationTools {...args} />;
|
|
21
|
-
|
|
22
21
|
export const DefaultConfig = Template.bind({});
|
|
23
22
|
DefaultConfig.parameters = {};
|
|
24
23
|
DefaultConfig.args = {};
|
|
@@ -39,7 +38,7 @@ ShowCenterLocationButton.args = {
|
|
|
39
38
|
export const AlterToolPosition = Template.bind({});
|
|
40
39
|
AlterToolPosition.parameters = {};
|
|
41
40
|
AlterToolPosition.args = {
|
|
42
|
-
sx: { top:
|
|
41
|
+
sx: { top: '10px', right: '5px' },
|
|
43
42
|
};
|
|
44
43
|
|
|
45
44
|
export const NoZoomButtons = Template.bind({});
|
|
@@ -58,8 +57,8 @@ export const CustomButton = Template.bind({});
|
|
|
58
57
|
CustomButton.parameters = {};
|
|
59
58
|
CustomButton.args = {
|
|
60
59
|
children: (
|
|
61
|
-
<Button onClick={() => {}}>
|
|
62
|
-
<BuildIcon sx={{ fontSize:
|
|
60
|
+
<Button variant="navtools" onClick={() => {}}>
|
|
61
|
+
<BuildIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
|
|
63
62
|
</Button>
|
|
64
63
|
),
|
|
65
64
|
};
|
|
@@ -46,11 +46,16 @@ interface MlNavigationToolsProps {
|
|
|
46
46
|
* Style attribute for NavigationTools container
|
|
47
47
|
*/
|
|
48
48
|
sx?: SxProps;
|
|
49
|
+
/**
|
|
50
|
+
* Style attribute for NavigationTools container
|
|
51
|
+
*/
|
|
52
|
+
mediaIsMobile?: boolean;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
/**
|
|
52
56
|
* @component
|
|
53
57
|
*/
|
|
58
|
+
|
|
54
59
|
const MlNavigationTools = (props: MlNavigationToolsProps) => {
|
|
55
60
|
const mapHook = useMap({
|
|
56
61
|
mapId: props.mapId,
|
|
@@ -58,32 +63,13 @@ const MlNavigationTools = (props: MlNavigationToolsProps) => {
|
|
|
58
63
|
});
|
|
59
64
|
|
|
60
65
|
const [pitch, setPitch] = useState(0);
|
|
61
|
-
const mediaIsMobile = useMediaQuery(
|
|
62
|
-
const buttonStyle = {
|
|
63
|
-
minWidth: "20px",
|
|
64
|
-
minHeight: "20px",
|
|
65
|
-
width: mediaIsMobile ? "50px" : "30px",
|
|
66
|
-
height: mediaIsMobile ? "50px" : "30px",
|
|
67
|
-
backgroundColor: "#414141",
|
|
68
|
-
borderRadius: "23%",
|
|
69
|
-
//border: "1px solid #bbb",
|
|
70
|
-
//boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
|
|
71
|
-
margin: 0.15,
|
|
72
|
-
fontSize: mediaIsMobile ? "1.4em" : "1.2em",
|
|
73
|
-
":hover": {
|
|
74
|
-
backgroundColor: "#515151",
|
|
75
|
-
},
|
|
76
|
-
color: "#ececec",
|
|
77
|
-
};
|
|
78
|
-
const iconStyle = {
|
|
79
|
-
fontSize: buttonStyle.fontSize,
|
|
80
|
-
};
|
|
66
|
+
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
81
67
|
|
|
82
68
|
useEffect(() => {
|
|
83
69
|
if (!mapHook.map) return;
|
|
84
70
|
|
|
85
71
|
mapHook.map.on(
|
|
86
|
-
|
|
72
|
+
'pitchend',
|
|
87
73
|
() => {
|
|
88
74
|
if (!mapHook.map) return;
|
|
89
75
|
|
|
@@ -124,63 +110,53 @@ const MlNavigationTools = (props: MlNavigationToolsProps) => {
|
|
|
124
110
|
<Box
|
|
125
111
|
sx={{
|
|
126
112
|
zIndex: 501,
|
|
127
|
-
position:
|
|
128
|
-
display:
|
|
129
|
-
flexDirection:
|
|
130
|
-
...(mediaIsMobile ? { margin:
|
|
113
|
+
position: 'absolute',
|
|
114
|
+
display: 'flex',
|
|
115
|
+
flexDirection: 'column',
|
|
116
|
+
...(mediaIsMobile ? { margin: '20px 10px 20px 10px' } : {}),
|
|
131
117
|
...props.sx,
|
|
132
118
|
}}
|
|
133
119
|
>
|
|
134
120
|
<MlNavigationCompass
|
|
135
121
|
style={{
|
|
136
|
-
width:
|
|
137
|
-
position:
|
|
138
|
-
height: mediaIsMobile ?
|
|
139
|
-
marginLeft: mediaIsMobile ?
|
|
140
|
-
transform: mediaIsMobile ?
|
|
122
|
+
width: '31px',
|
|
123
|
+
position: 'relative',
|
|
124
|
+
height: mediaIsMobile ? '55px' : '45px',
|
|
125
|
+
marginLeft: mediaIsMobile ? '3px' : '-5px',
|
|
126
|
+
transform: mediaIsMobile ? 'scale(1.6)' : 'scale(1)',
|
|
141
127
|
}}
|
|
142
128
|
backgroundStyle={{
|
|
143
|
-
boxShadow:
|
|
129
|
+
boxShadow: '0px 0px 18px rgba(0,0,0,.5)',
|
|
144
130
|
}}
|
|
145
131
|
/>
|
|
146
132
|
{props.show3DButton && (
|
|
147
|
-
<Button
|
|
148
|
-
|
|
149
|
-
onClick={adjustPitch}
|
|
150
|
-
>
|
|
151
|
-
{pitch ? "2D" : "3D"}
|
|
133
|
+
<Button variant="navtools" onClick={adjustPitch}>
|
|
134
|
+
{pitch ? '2D' : '3D'}
|
|
152
135
|
</Button>
|
|
153
136
|
)}
|
|
154
|
-
{props.showFollowGpsButton &&
|
|
155
|
-
|
|
156
|
-
)}
|
|
157
|
-
{props.showCenterLocationButton && (
|
|
158
|
-
<MlCenterPosition style={{ ...(({ color, ...rest }) => rest)(buttonStyle) }} />
|
|
159
|
-
)}
|
|
137
|
+
{props.showFollowGpsButton && <MlFollowGps />}
|
|
138
|
+
{props.showCenterLocationButton && <MlCenterPosition />}
|
|
160
139
|
<ButtonGroup
|
|
161
140
|
orientation="vertical"
|
|
162
141
|
sx={{
|
|
163
|
-
width:
|
|
164
|
-
border:
|
|
165
|
-
Button: { minWidth:
|
|
166
|
-
|
|
142
|
+
width: '50px',
|
|
143
|
+
border: 'none',
|
|
144
|
+
Button: { minWidth: '20px !important', border: 'none', padding: 0 },
|
|
145
|
+
'Button:hover': { border: 'none' },
|
|
167
146
|
}}
|
|
168
147
|
>
|
|
169
148
|
{props.showZoomButtons && (
|
|
170
149
|
<>
|
|
171
|
-
<Button
|
|
172
|
-
<ControlPointIcon sx={{
|
|
150
|
+
<Button variant="navtools" onClick={zoomIn}>
|
|
151
|
+
<ControlPointIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
|
|
173
152
|
</Button>
|
|
174
|
-
<Button
|
|
175
|
-
<RemoveCircleOutlineIcon sx={{
|
|
153
|
+
<Button variant="navtools" onClick={zoomOut}>
|
|
154
|
+
<RemoveCircleOutlineIcon sx={{ fontSize: { xs: '1.4em', md: '1em' } }} />
|
|
176
155
|
</Button>
|
|
177
156
|
</>
|
|
178
157
|
)}
|
|
179
158
|
</ButtonGroup>
|
|
180
|
-
{props.children &&
|
|
181
|
-
React.cloneElement(props.children, {
|
|
182
|
-
sx: { ...buttonStyle },
|
|
183
|
-
})}
|
|
159
|
+
{props.children && React.cloneElement(props.children, {})}
|
|
184
160
|
</Box>
|
|
185
161
|
);
|
|
186
162
|
};
|
|
@@ -84,7 +84,7 @@ export default function LayerPropertyForm({ paintProps = {}, setPaintProps }: Pr
|
|
|
84
84
|
<TextField
|
|
85
85
|
inputProps={{ inputMode: 'decimal', pattern: '[0-9]*' }}
|
|
86
86
|
value={paintProps[key]}
|
|
87
|
-
onChange={(ev: React.ChangeEvent) => {
|
|
87
|
+
onChange={(ev: React.ChangeEvent<HTMLInputElement>) => {
|
|
88
88
|
if (ev?.target?.value) {
|
|
89
89
|
setPaintProps((current) => ({ ...current, [key]: parseInt(ev.target.value) }));
|
|
90
90
|
}
|
|
@@ -18,7 +18,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
18
18
|
import LayerListItem from './LayerList/LayerListItem';
|
|
19
19
|
import GpsFixedIcon from '@mui/icons-material/GpsFixed';
|
|
20
20
|
import { Feature } from '@turf/turf';
|
|
21
|
-
import { LngLatLike } from '
|
|
21
|
+
import { LngLatLike } from 'maplibre-gl';
|
|
22
22
|
import { SxProps } from '@mui/system/styleFunctionSx/styleFunctionSx';
|
|
23
23
|
|
|
24
24
|
export interface MlSketchToolProps {
|