@mapcomponents/react-maplibre 0.1.62 → 0.1.64
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/.babelrc +21 -2
- package/.editorconfig +1 -1
- package/.eslintrc.js +11 -1
- package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
- package/.storybook/main.js +0 -1
- package/.storybook/preview.js +0 -2
- package/CHANGELOG.md +43 -0
- package/coverage/clover.xml +864 -1037
- package/coverage/coverage-final.json +32 -21
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +170 -95
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +148 -0
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +22 -7
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +72 -42
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +15 -15
- 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 +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +86 -35
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/{MlSpatialElevationProfile/MlSpatialElevationProfile.js.html → MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html} +215 -320
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +649 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +161 -0
- 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 +394 -0
- package/coverage/lcov-report/src/components/MlGpxViewer/index.html +116 -0
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
- 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 +58 -76
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
- 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 +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- 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.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.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 +214 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +121 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +412 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +463 -0
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +161 -0
- package/coverage/lcov-report/src/components/{MlGPXViewer/MlGPXViewer.tsx.html → MlSketchTool/MlSketchTool.tsx.html} +271 -589
- package/coverage/lcov-report/src/components/{MlGPXViewer → MlSketchTool}/index.html +22 -37
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
- 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 +10 -7
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
- 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 +111 -57
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
- 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 +50 -50
- 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 +1 -1
- package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
- package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
- package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
- package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +6 -6
- package/coverage/lcov.info +1724 -1974
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +46 -0
- package/cypress.config.ts +101 -0
- package/dist/components/MapLibreMap/MapLibreMap.d.ts +1 -1
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +53 -27
- package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
- package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
- package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.cy.d.ts +1 -0
- package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
- package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +10 -4
- package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -2
- package/dist/components/MlFeatureEditor/lib/theme.d.ts +1 -1
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +23 -12
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +12 -11
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +2 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
- package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
- package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
- package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
- package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
- package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
- package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
- package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +9 -0
- package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +5 -0
- package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +11 -0
- package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +9 -0
- package/dist/components/MlSketchTool/MlSketchTool.d.ts +29 -0
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +10 -0
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
- package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
- package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
- package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
- package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
- package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
- package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
- package/dist/contexts/SimpleDataProvider.d.ts +1 -1
- package/dist/custom.d.d.ts +1 -1
- package/dist/decorators/ThemeWrapper.d.ts +3 -1
- package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
- package/dist/hooks/useGpx/useGpx.d.ts +26 -0
- package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
- package/dist/hooks/useLayer.d.ts +14 -8
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
- package/dist/hooks/useMap.d.ts +2 -2
- package/dist/hooks/useMap.test.d.ts +1 -0
- package/dist/hooks/useMapState.d.ts +3 -3
- package/dist/hooks/useSource.d.ts +3 -3
- package/dist/hooks/useWms.d.ts +24 -16
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +9327 -14844
- package/dist/index.esm.js.map +1 -1
- package/dist/setupTests.d.ts +6 -5
- package/dist/ui_components/Dropzone.d.ts +5 -0
- package/dist/ui_components/ImageLoader.d.ts +8 -1
- package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
- package/dist/ui_components/Sidebar.d.ts +10 -1
- package/dist/ui_components/Tooltip.d.ts +1 -1
- package/dist/ui_components/TopToolbar.d.ts +7 -1
- package/dist/ui_components/UploadButton.d.ts +6 -0
- package/dist/util/BubbleForInstructions.d.ts +2 -0
- package/dist/util/Instructions.d.ts +13 -0
- package/package.json +195 -185
- package/public/assets/sample1.gpx +3003 -0
- package/public/assets/sample2.gpx +1264 -0
- package/public/assets/sample3.gpx +912 -0
- package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
- package/public/index.html +0 -4
- package/public/thumbnails/MlSketchTool.png +0 -0
- package/public/thumbnails/useCameraFollowPath.png +0 -0
- package/scripts/build-catalogue-meta.js +35 -11
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
- package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
- package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
- package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
- package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
- package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +21 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +1 -3
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -3
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +39 -29
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
- package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +191 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +47 -30
- package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
- package/src/components/MlGeoJsonLayer/assets/sample_1.json +138 -24
- package/src/components/MlGeoJsonLayer/assets/sample_2.json +140 -20
- package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +189 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +188 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
- package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
- package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
- package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
- package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
- package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
- package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +68 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
- package/src/components/MlLayer/MlLayer.meta_.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
- package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
- package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
- package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
- package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
- package/src/components/MlMarker/MlMarker.meta_.json +1 -2
- package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
- package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
- package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
- package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
- package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +43 -0
- package/src/components/MlSketchTool/LayerList/LayerList.tsx +12 -0
- package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +109 -0
- package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +126 -0
- package/src/components/MlSketchTool/MlSketchTool.doc.de.md +3 -0
- package/src/components/MlSketchTool/MlSketchTool.meta.json +14 -0
- package/src/components/MlSketchTool/MlSketchTool.stories.js +26 -0
- package/src/components/MlSketchTool/MlSketchTool.tsx +271 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
- package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +3 -4
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
- package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
- package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
- package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
- package/src/decorators/MapContextDecorator.js +1 -1
- package/src/decorators/MapContextDecoratorHooks.js +1 -1
- package/src/decorators/ThemeWrapper.tsx +9 -0
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
- package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
- package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
- package/src/hooks/useGpx/useGpx.meta_.json +15 -0
- package/src/{components/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
- package/src/hooks/useGpx/useGpx.tsx +70 -0
- package/src/hooks/useLayer.ts +32 -10
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
- package/src/hooks/useMap.test.tsx +48 -0
- package/src/hooks/useMap.ts +8 -8
- package/src/hooks/useSource.ts +4 -4
- package/src/hooks/{useWms.js → useWms.ts} +24 -11
- package/src/index.ts +5 -5
- package/src/setupTests.js +18 -15
- package/src/ui_components/Dropzone.tsx +104 -0
- package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
- package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
- package/src/ui_components/Sidebar.tsx +82 -0
- package/src/ui_components/Tooltip.tsx +17 -0
- package/src/ui_components/TopToolbar.tsx +26 -0
- package/src/ui_components/UploadButton.tsx +57 -0
- package/src/util/BubbleForInstructions.js +46 -0
- package/src/util/Instructions.tsx +60 -0
- package/tsconfig.json +39 -58
- package/config/getHttpsConfig.js +0 -66
- package/config/modules.js +0 -134
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -757
- package/config/webpackDevServer.config.js +0 -130
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
- package/scripts/start.js +0 -166
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -31
- package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -377
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +0 -66
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
- package/src/decorators/ThemeWrapper.jsx +0 -9
- package/src/ui_components/Legend.js +0 -44
- package/src/ui_components/LoadingOverlay.js +0 -41
- package/src/ui_components/Sidebar.js +0 -100
- package/src/ui_components/Tooltip.js +0 -21
- package/src/ui_components/TopToolbar.js +0 -29
|
@@ -279,15 +279,7 @@
|
|
|
279
279
|
<a name='L214'></a><a href='#L214'>214</a>
|
|
280
280
|
<a name='L215'></a><a href='#L215'>215</a>
|
|
281
281
|
<a name='L216'></a><a href='#L216'>216</a>
|
|
282
|
-
<a name='L217'></a><a href='#L217'>217</a>
|
|
283
|
-
<a name='L218'></a><a href='#L218'>218</a>
|
|
284
|
-
<a name='L219'></a><a href='#L219'>219</a>
|
|
285
|
-
<a name='L220'></a><a href='#L220'>220</a>
|
|
286
|
-
<a name='L221'></a><a href='#L221'>221</a>
|
|
287
|
-
<a name='L222'></a><a href='#L222'>222</a>
|
|
288
|
-
<a name='L223'></a><a href='#L223'>223</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
289
|
-
<span class="cline-any cline-neutral"> </span>
|
|
290
|
-
<span class="cline-any cline-neutral"> </span>
|
|
282
|
+
<a name='L217'></a><a href='#L217'>217</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
291
283
|
<span class="cline-any cline-neutral"> </span>
|
|
292
284
|
<span class="cline-any cline-neutral"> </span>
|
|
293
285
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -368,8 +360,6 @@
|
|
|
368
360
|
<span class="cline-any cline-neutral"> </span>
|
|
369
361
|
<span class="cline-any cline-yes">1x</span>
|
|
370
362
|
<span class="cline-any cline-neutral"> </span>
|
|
371
|
-
<span class="cline-any cline-neutral"> </span>
|
|
372
|
-
<span class="cline-any cline-neutral"> </span>
|
|
373
363
|
<span class="cline-any cline-yes">1x</span>
|
|
374
364
|
<span class="cline-any cline-neutral"> </span>
|
|
375
365
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -386,9 +376,6 @@
|
|
|
386
376
|
<span class="cline-any cline-yes">1x</span>
|
|
387
377
|
<span class="cline-any cline-neutral"> </span>
|
|
388
378
|
<span class="cline-any cline-yes">1x</span>
|
|
389
|
-
<span class="cline-any cline-neutral"> </span>
|
|
390
|
-
<span class="cline-any cline-neutral"> </span>
|
|
391
|
-
<span class="cline-any cline-neutral"> </span>
|
|
392
379
|
<span class="cline-any cline-yes">1x</span>
|
|
393
380
|
<span class="cline-any cline-yes">1x</span>
|
|
394
381
|
<span class="cline-any cline-yes">1x</span>
|
|
@@ -507,20 +494,15 @@
|
|
|
507
494
|
<span class="cline-any cline-neutral"> </span>
|
|
508
495
|
<span class="cline-any cline-neutral"> </span>
|
|
509
496
|
<span class="cline-any cline-neutral"> </span>
|
|
510
|
-
<span class="cline-any cline-neutral"> </span
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
useRef,
|
|
514
|
-
useEffect,
|
|
515
|
-
useState,
|
|
516
|
-
useMemo
|
|
517
|
-
} from "react";
|
|
497
|
+
<span class="cline-any cline-neutral"> </span>
|
|
498
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useContext, useCallback, useRef, useEffect, useState, useMemo } from 'react';
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
518
500
|
// @ts-ignore
|
|
519
|
-
import syncMove from
|
|
520
|
-
import
|
|
521
|
-
import
|
|
501
|
+
import syncMove from '@mapbox/mapbox-gl-sync-move';
|
|
502
|
+
import './style.css';
|
|
503
|
+
import MapContext from '../../contexts/MapContext';
|
|
522
504
|
|
|
523
|
-
interface MlLayerMagnifyProps {
|
|
505
|
+
export interface MlLayerMagnifyProps {
|
|
524
506
|
/**
|
|
525
507
|
* Id of the first MapLibre instance
|
|
526
508
|
*/
|
|
@@ -533,6 +515,10 @@ interface MlLayerMagnifyProps {
|
|
|
533
515
|
* Size of the "magnifier"-circle
|
|
534
516
|
*/
|
|
535
517
|
magnifierRadius?: number;
|
|
518
|
+
/**
|
|
519
|
+
* object (React.CSSProperties) that is added to the magnifier default style
|
|
520
|
+
*/
|
|
521
|
+
magnifierStyle: React.CSSProperties | undefined;
|
|
536
522
|
}
|
|
537
523
|
|
|
538
524
|
/**
|
|
@@ -541,7 +527,7 @@ interface MlLayerMagnifyProps {
|
|
|
541
527
|
* the map and can be dragged around on top of the MapLibreMap referenced by props.map1Id
|
|
542
528
|
*/
|
|
543
529
|
const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
544
|
-
const mapContext:MapContextType = useContext(MapContext);
|
|
530
|
+
const mapContext: MapContextType = useContext(MapContext);
|
|
545
531
|
const syncMoveInitializedRef = useRef(false);
|
|
546
532
|
const syncCleanupFunctionRef = useRef(<span class="fstat-no" title="function not covered" >()</span> => {});
|
|
547
533
|
|
|
@@ -552,7 +538,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
552
538
|
|
|
553
539
|
const magnifierRadius = useMemo(() => {
|
|
554
540
|
return props.magnifierRadius || <span class="branch-1 cbranch-no" title="branch not covered" >200;</span>
|
|
555
|
-
},[props.magnifierRadius]);
|
|
541
|
+
}, [props.magnifierRadius]);
|
|
556
542
|
|
|
557
543
|
const mapExists = useCallback(() => {
|
|
558
544
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!props.map1Id || !props.map2Id) {
|
|
@@ -575,11 +561,11 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
575
561
|
});
|
|
576
562
|
|
|
577
563
|
useEffect(() => {
|
|
578
|
-
window.addEventListener(
|
|
579
|
-
|
|
564
|
+
window.addEventListener('resize', onResize.current);
|
|
565
|
+
const _onResize = onResize.current;
|
|
580
566
|
|
|
581
567
|
return () => {
|
|
582
|
-
window.removeEventListener(
|
|
568
|
+
window.removeEventListener('resize', _onResize);
|
|
583
569
|
syncCleanupFunctionRef.current();
|
|
584
570
|
};
|
|
585
571
|
}, []);
|
|
@@ -588,29 +574,24 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
588
574
|
(e) => {
|
|
589
575
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!mapExists()) <span class="cstat-no" title="statement not covered" >return;</span>
|
|
590
576
|
|
|
591
|
-
|
|
592
|
-
.getCanvas()
|
|
593
|
-
.getBoundingClientRect();
|
|
577
|
+
const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
|
|
594
578
|
let clientX =
|
|
595
579
|
e.clientX ||
|
|
596
|
-
(typeof e.touches !==
|
|
580
|
+
(typeof e.touches !== 'undefined' && <span class="branch-1 cbranch-no" title="branch not covered" >typeof e.touches[0] !== 'undefined'</span>
|
|
597
581
|
? <span class="branch-0 cbranch-no" title="branch not covered" >e.touches[0].clientX</span>
|
|
598
582
|
: 0);
|
|
599
583
|
let clientY =
|
|
600
584
|
e.clientY ||
|
|
601
|
-
(typeof e.touches !==
|
|
585
|
+
(typeof e.touches !== 'undefined' && <span class="branch-1 cbranch-no" title="branch not covered" >typeof e.touches[0] !== 'undefined'</span>
|
|
602
586
|
? <span class="branch-0 cbranch-no" title="branch not covered" >e.touches[0].clientY</span>
|
|
603
587
|
: 0);
|
|
604
588
|
|
|
605
589
|
clientX -= bounds.x;
|
|
606
590
|
clientY -= bounds.y;
|
|
607
|
-
|
|
608
|
-
|
|
591
|
+
const swipeX_tmp = ((clientX / bounds.width) * 100).toFixed(2);
|
|
592
|
+
const swipeY_tmp = ((clientY / bounds.height) * 100).toFixed(2);
|
|
609
593
|
|
|
610
|
-
<span class="missing-if-branch" title="else path not taken" >E</span>if (
|
|
611
|
-
swipeXRef.current !== swipeX_tmp ||
|
|
612
|
-
<span class="branch-1 cbranch-no" title="branch not covered" > swipeYRef.current !== swipeY_tmp</span>
|
|
613
|
-
) {
|
|
594
|
+
<span class="missing-if-branch" title="else path not taken" >E</span>if (swipeXRef.current !== swipeX_tmp || <span class="branch-1 cbranch-no" title="branch not covered" >swipeYRef.current !== swipeY_tmp)</span> {
|
|
614
595
|
setSwipeX(swipeX_tmp);
|
|
615
596
|
swipeXRef.current = swipeX_tmp;
|
|
616
597
|
setSwipeY(swipeY_tmp);
|
|
@@ -619,9 +600,9 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
619
600
|
mapContext.maps[props.map2Id].getContainer().style.clipPath =
|
|
620
601
|
`circle(${magnifierRadius}px at ` +
|
|
621
602
|
(parseFloat(swipeXRef.current) * bounds.width) / 100 +
|
|
622
|
-
|
|
603
|
+
'px ' +
|
|
623
604
|
(parseFloat(swipeYRef.current) * bounds.height) / 100 +
|
|
624
|
-
|
|
605
|
+
'px)';
|
|
625
606
|
}
|
|
626
607
|
},
|
|
627
608
|
[mapContext, mapExists, props, magnifierRadius]
|
|
@@ -669,53 +650,53 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
669
650
|
});
|
|
670
651
|
}, [mapContext.mapIds, mapContext, mapExists, props, onMove]);
|
|
671
652
|
|
|
672
|
-
const onDown = <span class="fstat-no" title="function not covered" >(e</span>:
|
|
673
|
-
<span class="cstat-no" title="statement not covered" > if (e.
|
|
674
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
675
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
653
|
+
const onDown = <span class="fstat-no" title="function not covered" >(e</span>: React.MouseEvent | React.TouchEvent) => {
|
|
654
|
+
<span class="cstat-no" title="statement not covered" > if (e.nativeEvent instanceof TouchEvent) {</span>
|
|
655
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('touchmove', onMove);</span>
|
|
656
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('touchend', onTouchEnd);</span>
|
|
676
657
|
} else {
|
|
677
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
678
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
658
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('mousemove', onMove);</span>
|
|
659
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('mouseup', onMouseUp);</span>
|
|
679
660
|
}
|
|
680
661
|
};
|
|
681
662
|
|
|
682
663
|
const onTouchEnd = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
683
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
684
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
664
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('touchmove', onMove);</span>
|
|
665
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('touchend', onTouchEnd);</span>
|
|
685
666
|
};
|
|
686
667
|
|
|
687
668
|
const onMouseUp = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
688
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
689
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
669
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('mousemove', onMove);</span>
|
|
670
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('mouseup', onMouseUp);</span>
|
|
690
671
|
};
|
|
691
672
|
|
|
692
|
-
const onWheel = <span class="fstat-no" title="function not covered" >(e</span>:
|
|
693
|
-
|
|
673
|
+
const onWheel = <span class="fstat-no" title="function not covered" >(e</span>: React.WheelEvent) => {
|
|
674
|
+
const evCopy = <span class="cstat-no" title="statement not covered" >new WheelEvent(e.type, e as unknown as WheelEventInit);</span>
|
|
694
675
|
<span class="cstat-no" title="statement not covered" > mapContext.map.getCanvas().dispatchEvent(evCopy);</span>
|
|
695
676
|
};
|
|
696
677
|
|
|
697
678
|
return (
|
|
698
679
|
<div
|
|
699
680
|
style={{
|
|
700
|
-
position:
|
|
701
|
-
left: swipeX +
|
|
702
|
-
top: swipeY +
|
|
703
|
-
borderRadius:
|
|
704
|
-
width: magnifierRadius * 2
|
|
705
|
-
height: magnifierRadius * 2
|
|
706
|
-
background:
|
|
707
|
-
border:
|
|
708
|
-
boxShadow:
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
681
|
+
position: 'absolute',
|
|
682
|
+
left: swipeX + '%',
|
|
683
|
+
top: swipeY + '%',
|
|
684
|
+
borderRadius: '50%',
|
|
685
|
+
width: magnifierRadius * 2 - 2 + 'px',
|
|
686
|
+
height: magnifierRadius * 2 - 2 + 'px',
|
|
687
|
+
background: 'rgba(0,0,0,0)',
|
|
688
|
+
border: '2px solid #fafafa',
|
|
689
|
+
boxShadow: '1px 2px 2px rgba(19, 19, 19, .5), inset 1px 1px 1px rgba(19, 19, 19, .2)',
|
|
690
|
+
cursor: 'pointer',
|
|
691
|
+
zIndex: '110',
|
|
692
|
+
marginLeft: magnifierRadius * -1 - 1 + 'px',
|
|
693
|
+
marginTop: magnifierRadius * -1 - 1 + 'px',
|
|
694
|
+
textAlign: 'center',
|
|
695
|
+
lineHeight: '91px',
|
|
696
|
+
fontSize: '2em',
|
|
697
|
+
color: '#fafafa',
|
|
698
|
+
userSelect: 'none',
|
|
699
|
+
...props.magnifierStyle,
|
|
719
700
|
}}
|
|
720
701
|
onTouchStart={onDown}
|
|
721
702
|
onMouseDown={onDown}
|
|
@@ -726,6 +707,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
|
|
|
726
707
|
|
|
727
708
|
MlLayerMagnify.defaultProps = {
|
|
728
709
|
magnifierRadius: 200,
|
|
710
|
+
magnifierStyle: {},
|
|
729
711
|
};
|
|
730
712
|
|
|
731
713
|
export default MlLayerMagnify;
|
|
@@ -736,7 +718,7 @@ export default MlLayerMagnify;
|
|
|
736
718
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
737
719
|
Code coverage generated by
|
|
738
720
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
739
|
-
at
|
|
721
|
+
at 2023-01-15T17:55:43.336Z
|
|
740
722
|
</div>
|
|
741
723
|
<script src="../../../prettify.js"></script>
|
|
742
724
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at 2023-01-15T17:55:43.336Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">77.08% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>37/48</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">78.26% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>36/46</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -208,9 +208,7 @@
|
|
|
208
208
|
<a name='L143'></a><a href='#L143'>143</a>
|
|
209
209
|
<a name='L144'></a><a href='#L144'>144</a>
|
|
210
210
|
<a name='L145'></a><a href='#L145'>145</a>
|
|
211
|
-
<a name='L146'></a><a href='#L146'>146</a>
|
|
212
|
-
<a name='L147'></a><a href='#L147'>147</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
213
|
-
<span class="cline-any cline-neutral"> </span>
|
|
211
|
+
<a name='L146'></a><a href='#L146'>146</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
214
212
|
<span class="cline-any cline-neutral"> </span>
|
|
215
213
|
<span class="cline-any cline-neutral"> </span>
|
|
216
214
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -265,8 +263,6 @@
|
|
|
265
263
|
<span class="cline-any cline-neutral"> </span>
|
|
266
264
|
<span class="cline-any cline-yes">1x</span>
|
|
267
265
|
<span class="cline-any cline-neutral"> </span>
|
|
268
|
-
<span class="cline-any cline-neutral"> </span>
|
|
269
|
-
<span class="cline-any cline-neutral"> </span>
|
|
270
266
|
<span class="cline-any cline-yes">1x</span>
|
|
271
267
|
<span class="cline-any cline-neutral"> </span>
|
|
272
268
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -279,11 +275,8 @@
|
|
|
279
275
|
<span class="cline-any cline-yes">1x</span>
|
|
280
276
|
<span class="cline-any cline-yes">1x</span>
|
|
281
277
|
<span class="cline-any cline-neutral"> </span>
|
|
282
|
-
<span class="cline-any cline-neutral"> </span>
|
|
283
278
|
<span class="cline-any cline-yes">1x</span>
|
|
284
279
|
<span class="cline-any cline-neutral"> </span>
|
|
285
|
-
<span class="cline-any cline-neutral"> </span>
|
|
286
|
-
<span class="cline-any cline-neutral"> </span>
|
|
287
280
|
<span class="cline-any cline-yes">1x</span>
|
|
288
281
|
<span class="cline-any cline-neutral"> </span>
|
|
289
282
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -355,19 +348,19 @@
|
|
|
355
348
|
<span class="cline-any cline-neutral"> </span>
|
|
356
349
|
<span class="cline-any cline-neutral"> </span>
|
|
357
350
|
<span class="cline-any cline-neutral"> </span>
|
|
358
|
-
<span class="cline-any cline-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
351
|
+
<span class="cline-any cline-yes">11x</span>
|
|
352
|
+
<span class="cline-any cline-neutral"> </span>
|
|
353
|
+
<span class="cline-any cline-neutral"> </span>
|
|
354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
355
|
+
<span class="cline-any cline-neutral"> </span>
|
|
356
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useContext, useCallback, useRef, useEffect, useState } from 'react';
|
|
357
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
365
358
|
// @ts-ignore
|
|
366
|
-
import syncMove from
|
|
367
|
-
import
|
|
368
|
-
import MapContext from
|
|
359
|
+
import syncMove from '@mapbox/mapbox-gl-sync-move';
|
|
360
|
+
import './style.css';
|
|
361
|
+
import MapContext from '../../contexts/MapContext';
|
|
369
362
|
|
|
370
|
-
interface MlLayerSwipeProps {
|
|
363
|
+
export interface MlLayerSwipeProps {
|
|
371
364
|
/**
|
|
372
365
|
* Id of the first MapLibre instance.
|
|
373
366
|
*/
|
|
@@ -376,6 +369,10 @@ interface MlLayerSwipeProps {
|
|
|
376
369
|
* Id of the second MapLibre instance.
|
|
377
370
|
*/
|
|
378
371
|
map2Id: string;
|
|
372
|
+
/**
|
|
373
|
+
* object (React.CSSProperties) that is added to the button default style
|
|
374
|
+
*/
|
|
375
|
+
buttonStyle: React.CSSProperties | undefined;
|
|
379
376
|
}
|
|
380
377
|
|
|
381
378
|
/**
|
|
@@ -402,33 +399,28 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
402
399
|
}, [mapContext, props.map1Id, props.map2Id]);
|
|
403
400
|
|
|
404
401
|
const cleanup = () => {
|
|
405
|
-
|
|
402
|
+
syncCleanupFunctionRef.current();
|
|
406
403
|
};
|
|
407
404
|
|
|
408
405
|
const onMove = useCallback(
|
|
409
406
|
(e) => {
|
|
410
407
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!mapExists()) <span class="cstat-no" title="statement not covered" >return;</span>
|
|
411
408
|
|
|
412
|
-
|
|
413
|
-
.getCanvas()
|
|
414
|
-
.getBoundingClientRect();
|
|
409
|
+
const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
|
|
415
410
|
let clientX =
|
|
416
411
|
e.clientX ||
|
|
417
|
-
(typeof e.touches !==
|
|
412
|
+
(typeof e.touches !== 'undefined' && <span class="branch-1 cbranch-no" title="branch not covered" >typeof e.touches[0] !== 'undefined'</span>
|
|
418
413
|
? <span class="branch-0 cbranch-no" title="branch not covered" >e.touches[0].clientX</span>
|
|
419
414
|
: 0);
|
|
420
415
|
|
|
421
416
|
clientX -= bounds.x;
|
|
422
|
-
|
|
417
|
+
const swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
|
|
423
418
|
|
|
424
419
|
<span class="missing-if-branch" title="else path not taken" >E</span>if (swipeXRef.current !== swipeX_tmp) {
|
|
425
420
|
setSwipeX(swipeX_tmp);
|
|
426
421
|
swipeXRef.current = swipeX_tmp;
|
|
427
422
|
|
|
428
|
-
|
|
429
|
-
"rect(0, " +
|
|
430
|
-
(swipeXRef.current * bounds.width) / 100 +
|
|
431
|
-
"px, 999em, 0)";
|
|
423
|
+
const clipA = 'rect(0, ' + (swipeXRef.current * bounds.width) / 100 + 'px, 999em, 0)';
|
|
432
424
|
|
|
433
425
|
mapContext.maps[props.map2Id].getContainer().style.clip = clipA;
|
|
434
426
|
}
|
|
@@ -453,46 +445,47 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
453
445
|
});
|
|
454
446
|
}, [mapContext.mapIds, mapContext, props, onMove, mapExists]);
|
|
455
447
|
|
|
456
|
-
const onDown = <span class="fstat-no" title="function not covered" >(e</span>:
|
|
457
|
-
<span class="cstat-no" title="statement not covered" > if (e.
|
|
458
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
459
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
448
|
+
const onDown = <span class="fstat-no" title="function not covered" >(e</span>: React.MouseEvent | React.TouchEvent) => {
|
|
449
|
+
<span class="cstat-no" title="statement not covered" > if (e.nativeEvent instanceof TouchEvent) {</span>
|
|
450
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('touchmove', onMove);</span>
|
|
451
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('touchend', onTouchEnd);</span>
|
|
460
452
|
} else {
|
|
461
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
462
|
-
<span class="cstat-no" title="statement not covered" > document.addEventListener(
|
|
453
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('mousemove', onMove);</span>
|
|
454
|
+
<span class="cstat-no" title="statement not covered" > document.addEventListener('mouseup', onMouseUp);</span>
|
|
463
455
|
}
|
|
464
456
|
};
|
|
465
457
|
|
|
466
458
|
const onTouchEnd = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
467
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
468
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
459
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('touchmove', onMove);</span>
|
|
460
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('touchend', onTouchEnd);</span>
|
|
469
461
|
};
|
|
470
462
|
|
|
471
463
|
const onMouseUp = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
472
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
473
|
-
<span class="cstat-no" title="statement not covered" > document.removeEventListener(
|
|
464
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('mousemove', onMove);</span>
|
|
465
|
+
<span class="cstat-no" title="statement not covered" > document.removeEventListener('mouseup', onMouseUp);</span>
|
|
474
466
|
};
|
|
475
467
|
|
|
476
468
|
return (
|
|
477
469
|
<div
|
|
478
470
|
style={{
|
|
479
|
-
position:
|
|
480
|
-
left: swipeX +
|
|
481
|
-
top:
|
|
482
|
-
borderRadius:
|
|
483
|
-
width:
|
|
484
|
-
height:
|
|
485
|
-
background:
|
|
486
|
-
border:
|
|
487
|
-
cursor:
|
|
488
|
-
zIndex:
|
|
489
|
-
marginLeft:
|
|
490
|
-
marginTop:
|
|
491
|
-
textAlign:
|
|
492
|
-
lineHeight:
|
|
493
|
-
fontSize:
|
|
494
|
-
color:
|
|
495
|
-
userSelect:
|
|
471
|
+
position: 'absolute',
|
|
472
|
+
left: swipeX + '%',
|
|
473
|
+
top: '50%',
|
|
474
|
+
borderRadius: '50%',
|
|
475
|
+
width: '100px',
|
|
476
|
+
height: '100px',
|
|
477
|
+
background: '#0066ff',
|
|
478
|
+
border: '3px solid #eaebf1',
|
|
479
|
+
cursor: 'pointer',
|
|
480
|
+
zIndex: '110',
|
|
481
|
+
marginLeft: '-50px',
|
|
482
|
+
marginTop: '-50px',
|
|
483
|
+
textAlign: 'center',
|
|
484
|
+
lineHeight: '91px',
|
|
485
|
+
fontSize: '2em',
|
|
486
|
+
color: '#fafafa',
|
|
487
|
+
userSelect: 'none',
|
|
488
|
+
...props.buttonStyle,
|
|
496
489
|
}}
|
|
497
490
|
onTouchStart={onDown}
|
|
498
491
|
onMouseDown={onDown}
|
|
@@ -500,6 +493,10 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
|
500
493
|
);
|
|
501
494
|
};
|
|
502
495
|
|
|
496
|
+
MlLayerSwipe.defaultProps = {
|
|
497
|
+
buttonStyle: {},
|
|
498
|
+
};
|
|
499
|
+
|
|
503
500
|
export default MlLayerSwipe;
|
|
504
501
|
</pre></td></tr></table></pre>
|
|
505
502
|
|
|
@@ -508,7 +505,7 @@ export default MlLayerSwipe;
|
|
|
508
505
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
509
506
|
Code coverage generated by
|
|
510
507
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
511
|
-
at
|
|
508
|
+
at 2023-01-15T17:55:43.336Z
|
|
512
509
|
</div>
|
|
513
510
|
<script src="../../../prettify.js"></script>
|
|
514
511
|
<script>
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">77.08% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>37/48</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">78.26% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>36/46</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -80,17 +80,17 @@
|
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
82
|
<td class="file medium" data-value="MlLayerSwipe.tsx"><a href="MlLayerSwipe.tsx.html">MlLayerSwipe.tsx</a></td>
|
|
83
|
-
<td data-value="
|
|
84
|
-
<div class="chart"><div class="cover-fill" style="width:
|
|
83
|
+
<td data-value="77.08" class="pic medium">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 77%"></div><div class="cover-empty" style="width: 23%"></div></div>
|
|
85
85
|
</td>
|
|
86
|
-
<td data-value="
|
|
87
|
-
<td data-value="
|
|
86
|
+
<td data-value="77.08" class="pct medium">77.08%</td>
|
|
87
|
+
<td data-value="48" class="abs medium">37/48</td>
|
|
88
88
|
<td data-value="70.83" class="pct medium">70.83%</td>
|
|
89
89
|
<td data-value="24" class="abs medium">17/24</td>
|
|
90
90
|
<td data-value="60" class="pct medium">60%</td>
|
|
91
91
|
<td data-value="10" class="abs medium">6/10</td>
|
|
92
|
-
<td data-value="
|
|
93
|
-
<td data-value="
|
|
92
|
+
<td data-value="78.26" class="pct medium">78.26%</td>
|
|
93
|
+
<td data-value="46" class="abs medium">36/46</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
</tbody>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at 2023-01-15T17:55:43.336Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -721,7 +721,7 @@ export default MlLayerSwitcher;
|
|
|
721
721
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
722
722
|
Code coverage generated by
|
|
723
723
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
724
|
-
at
|
|
724
|
+
at 2023-01-15T17:55:43.336Z
|
|
725
725
|
</div>
|
|
726
726
|
<script src="../../../prettify.js"></script>
|
|
727
727
|
<script>
|