@mapcomponents/react-maplibre 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node_version_test.yml +1 -1
- package/.storybook/main.js +37 -31
- package/.storybook/preview.js +21 -0
- package/CHANGELOG.md +13 -0
- package/coverage/clover.xml +419 -344
- package/coverage/coverage-final.json +15 -14
- package/coverage/lcov-report/index.html +61 -61
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -18
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +14 -14
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- 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 +9 -9
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +1 -1
- 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 +52 -40
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +10 -10
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +4 -4
- 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 +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 → MlScaleReference.tsx.html} +57 -36
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +2 -2
- package/coverage/lcov-report/src/components/MlShareMapState/{MlShareMapState.js.html → MlShareMapState.tsx.html} +192 -84
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +20 -20
- 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 +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +1 -1
- 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 +769 -0
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +25 -10
- 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 +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +11 -11
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +11 -11
- 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 +27 -18
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +11 -11
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +50 -26
- 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 +21 -21
- 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 +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 +9 -9
- 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 +9 -6
- package/coverage/lcov-report/src/hooks/useMap.ts.html +2 -2
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +8 -29
- package/coverage/lcov-report/src/hooks/useSource.ts.html +10 -10
- 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 +80 -11
- package/coverage/lcov.info +741 -604
- package/dist/components/MapLibreMap/MapLibreMap.stories.d.ts +3 -0
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +17 -15
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +1 -1
- package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +1 -1
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +1 -1
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +1 -1
- package/dist/components/MlFeatureEditor/lib/create_supplementary_points.d.ts +1 -1
- package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +1 -1
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +1 -1
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +1 -1
- package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +1 -1
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +1 -1
- package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +1 -1
- package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +1 -1
- package/dist/components/MlScaleReference/MlScaleReference.d.ts +7 -1
- package/dist/components/MlShareMapState/MlShareMapState.d.ts +32 -13
- package/dist/components/MlShareMapState/MlShareMapState.stories.d.ts +15 -9
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +1 -1
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +1 -1
- package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +1 -1
- package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +1 -1
- package/dist/components/MlThreeJsLayer/MlThreejsLayer.d.ts +29 -0
- package/dist/components/MlThreeJsLayer/lib/GLTFLoader.d.ts +2 -1
- package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +1 -1
- package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +1 -1
- package/dist/contexts/MapContext.d.ts +13 -2
- package/dist/custom.d.d.ts +1 -1
- package/dist/decorators/MapContextDecorator.d.ts +1 -1
- package/dist/decorators/MapContextDecoratorHooks.d.ts +1 -1
- package/dist/decorators/MultiMapContextDecorator.d.ts +1 -1
- package/dist/decorators/NoNavToolsDecorator.d.ts +1 -1
- package/dist/decorators/ThemeWrapper.d.ts +1 -3
- package/dist/hooks/useCameraFollowPath/useCameraFollowPath.stories.d.ts +1 -1
- package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +1 -1
- package/dist/index.d.ts +18 -8
- package/dist/index.esm.js +5590 -3701
- package/dist/index.esm.js.map +1 -1
- package/dist/setupTests.d.ts +6 -6
- package/package.json +56 -49
- package/public/thumbnails/{MlGPXViewer.png → MlGpxViewer.png} +0 -0
- package/rollup.config.js +49 -48
- package/src/@types/assets/index.d.ts +20 -0
- package/src/components/MapLibreMap/MapLibreMap.stories.js +8 -1
- package/src/components/MapLibreMap/MapLibreMap.tsx +11 -9
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +49 -39
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +1 -1
- package/src/components/MlFollowGps/MlFollowGps.tsx +8 -8
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +21 -17
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +3 -3
- package/src/components/MlScaleReference/{MlScaleReference.js → MlScaleReference.tsx} +38 -31
- package/src/components/MlShareMapState/MlShareMapState.stories.tsx +100 -0
- package/src/components/MlShareMapState/{MlShareMapState.js → MlShareMapState.tsx} +94 -58
- package/src/components/MlThreeJsLayer/MlThreejsLayer.tsx +228 -0
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +7 -4
- package/src/contexts/MapContext.tsx +26 -19
- package/src/custom.d.ts +5 -0
- package/src/decorators/MapContextDecorator.js +39 -28
- package/src/decorators/MapContextDecoratorHooks.js +18 -8
- package/src/decorators/MultiMapContextDecorator.js +79 -69
- package/src/decorators/NoNavToolsDecorator.js +34 -25
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +5 -4
- package/src/hooks/useMap.ts +1 -1
- package/src/hooks/useMapState.ts +6 -13
- package/src/hooks/useSource.ts +1 -1
- package/src/index.ts +31 -8
- package/src/ui_components/TopToolbar.tsx +1 -1
- package/tsconfig.json +1 -0
- package/src/components/MlShareMapState/MlShareMapState.stories.js +0 -100
- package/src/custom.d.tsx +0 -26
- package/src/decorators/ThemeWrapper.tsx +0 -9
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for src/components/MlShareMapState/MlShareMapState.
|
|
6
|
+
<title>Code coverage report for src/components/MlShareMapState/MlShareMapState.tsx</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
8
|
<link rel="stylesheet" href="../../../prettify.css" />
|
|
9
9
|
<link rel="stylesheet" href="../../../base.css" />
|
|
@@ -19,34 +19,34 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="../../../index.html">All files</a> / <a href="index.html">src/components/MlShareMapState</a> MlShareMapState.
|
|
22
|
+
<h1><a href="../../../index.html">All files</a> / <a href="index.html">src/components/MlShareMapState</a> MlShareMapState.tsx</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">7.47% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>8/107</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">1.56% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>1/64</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">5.88% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>1/17</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">8% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>8/100</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -296,21 +296,52 @@
|
|
|
296
296
|
<a name='L231'></a><a href='#L231'>231</a>
|
|
297
297
|
<a name='L232'></a><a href='#L232'>232</a>
|
|
298
298
|
<a name='L233'></a><a href='#L233'>233</a>
|
|
299
|
-
<a name='L234'></a><a href='#L234'>234</a
|
|
299
|
+
<a name='L234'></a><a href='#L234'>234</a>
|
|
300
|
+
<a name='L235'></a><a href='#L235'>235</a>
|
|
301
|
+
<a name='L236'></a><a href='#L236'>236</a>
|
|
302
|
+
<a name='L237'></a><a href='#L237'>237</a>
|
|
303
|
+
<a name='L238'></a><a href='#L238'>238</a>
|
|
304
|
+
<a name='L239'></a><a href='#L239'>239</a>
|
|
305
|
+
<a name='L240'></a><a href='#L240'>240</a>
|
|
306
|
+
<a name='L241'></a><a href='#L241'>241</a>
|
|
307
|
+
<a name='L242'></a><a href='#L242'>242</a>
|
|
308
|
+
<a name='L243'></a><a href='#L243'>243</a>
|
|
309
|
+
<a name='L244'></a><a href='#L244'>244</a>
|
|
310
|
+
<a name='L245'></a><a href='#L245'>245</a>
|
|
311
|
+
<a name='L246'></a><a href='#L246'>246</a>
|
|
312
|
+
<a name='L247'></a><a href='#L247'>247</a>
|
|
313
|
+
<a name='L248'></a><a href='#L248'>248</a>
|
|
314
|
+
<a name='L249'></a><a href='#L249'>249</a>
|
|
315
|
+
<a name='L250'></a><a href='#L250'>250</a>
|
|
316
|
+
<a name='L251'></a><a href='#L251'>251</a>
|
|
317
|
+
<a name='L252'></a><a href='#L252'>252</a>
|
|
318
|
+
<a name='L253'></a><a href='#L253'>253</a>
|
|
319
|
+
<a name='L254'></a><a href='#L254'>254</a>
|
|
320
|
+
<a name='L255'></a><a href='#L255'>255</a>
|
|
321
|
+
<a name='L256'></a><a href='#L256'>256</a>
|
|
322
|
+
<a name='L257'></a><a href='#L257'>257</a>
|
|
323
|
+
<a name='L258'></a><a href='#L258'>258</a>
|
|
324
|
+
<a name='L259'></a><a href='#L259'>259</a>
|
|
325
|
+
<a name='L260'></a><a href='#L260'>260</a>
|
|
326
|
+
<a name='L261'></a><a href='#L261'>261</a>
|
|
327
|
+
<a name='L262'></a><a href='#L262'>262</a>
|
|
328
|
+
<a name='L263'></a><a href='#L263'>263</a>
|
|
329
|
+
<a name='L264'></a><a href='#L264'>264</a>
|
|
330
|
+
<a name='L265'></a><a href='#L265'>265</a>
|
|
331
|
+
<a name='L266'></a><a href='#L266'>266</a>
|
|
332
|
+
<a name='L267'></a><a href='#L267'>267</a>
|
|
333
|
+
<a name='L268'></a><a href='#L268'>268</a>
|
|
334
|
+
<a name='L269'></a><a href='#L269'>269</a>
|
|
335
|
+
<a name='L270'></a><a href='#L270'>270</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
300
336
|
<span class="cline-any cline-neutral"> </span>
|
|
301
337
|
<span class="cline-any cline-neutral"> </span>
|
|
302
338
|
<span class="cline-any cline-neutral"> </span>
|
|
303
339
|
<span class="cline-any cline-neutral"> </span>
|
|
304
340
|
<span class="cline-any cline-neutral"> </span>
|
|
305
341
|
<span class="cline-any cline-neutral"> </span>
|
|
306
|
-
<span class="cline-any cline-no"> </span>
|
|
307
|
-
<span class="cline-any cline-no"> </span>
|
|
308
|
-
<span class="cline-any cline-no"> </span>
|
|
309
342
|
<span class="cline-any cline-neutral"> </span>
|
|
310
|
-
<span class="cline-any cline-no"> </span>
|
|
311
343
|
<span class="cline-any cline-neutral"> </span>
|
|
312
344
|
<span class="cline-any cline-neutral"> </span>
|
|
313
|
-
<span class="cline-any cline-no"> </span>
|
|
314
345
|
<span class="cline-any cline-neutral"> </span>
|
|
315
346
|
<span class="cline-any cline-neutral"> </span>
|
|
316
347
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -320,7 +351,38 @@
|
|
|
320
351
|
<span class="cline-any cline-neutral"> </span>
|
|
321
352
|
<span class="cline-any cline-neutral"> </span>
|
|
322
353
|
<span class="cline-any cline-neutral"> </span>
|
|
323
|
-
<span class="cline-any cline-
|
|
354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
355
|
+
<span class="cline-any cline-yes">10x</span>
|
|
356
|
+
<span class="cline-any cline-yes">10x</span>
|
|
357
|
+
<span class="cline-any cline-yes">10x</span>
|
|
358
|
+
<span class="cline-any cline-neutral"> </span>
|
|
359
|
+
<span class="cline-any cline-yes">10x</span>
|
|
360
|
+
<span class="cline-any cline-neutral"> </span>
|
|
361
|
+
<span class="cline-any cline-neutral"> </span>
|
|
362
|
+
<span class="cline-any cline-yes">10x</span>
|
|
363
|
+
<span class="cline-any cline-neutral"> </span>
|
|
364
|
+
<span class="cline-any cline-neutral"> </span>
|
|
365
|
+
<span class="cline-any cline-neutral"> </span>
|
|
366
|
+
<span class="cline-any cline-neutral"> </span>
|
|
367
|
+
<span class="cline-any cline-neutral"> </span>
|
|
368
|
+
<span class="cline-any cline-neutral"> </span>
|
|
369
|
+
<span class="cline-any cline-neutral"> </span>
|
|
370
|
+
<span class="cline-any cline-neutral"> </span>
|
|
371
|
+
<span class="cline-any cline-neutral"> </span>
|
|
372
|
+
<span class="cline-any cline-neutral"> </span>
|
|
373
|
+
<span class="cline-any cline-neutral"> </span>
|
|
374
|
+
<span class="cline-any cline-neutral"> </span>
|
|
375
|
+
<span class="cline-any cline-neutral"> </span>
|
|
376
|
+
<span class="cline-any cline-neutral"> </span>
|
|
377
|
+
<span class="cline-any cline-neutral"> </span>
|
|
378
|
+
<span class="cline-any cline-neutral"> </span>
|
|
379
|
+
<span class="cline-any cline-neutral"> </span>
|
|
380
|
+
<span class="cline-any cline-neutral"> </span>
|
|
381
|
+
<span class="cline-any cline-neutral"> </span>
|
|
382
|
+
<span class="cline-any cline-neutral"> </span>
|
|
383
|
+
<span class="cline-any cline-neutral"> </span>
|
|
384
|
+
<span class="cline-any cline-neutral"> </span>
|
|
385
|
+
<span class="cline-any cline-yes">10x</span>
|
|
324
386
|
<span class="cline-any cline-neutral"> </span>
|
|
325
387
|
<span class="cline-any cline-no"> </span>
|
|
326
388
|
<span class="cline-any cline-no"> </span>
|
|
@@ -374,13 +436,13 @@
|
|
|
374
436
|
<span class="cline-any cline-neutral"> </span>
|
|
375
437
|
<span class="cline-any cline-neutral"> </span>
|
|
376
438
|
<span class="cline-any cline-no"> </span>
|
|
439
|
+
<span class="cline-any cline-neutral"> </span>
|
|
377
440
|
<span class="cline-any cline-no"> </span>
|
|
378
441
|
<span class="cline-any cline-neutral"> </span>
|
|
379
442
|
<span class="cline-any cline-neutral"> </span>
|
|
380
443
|
<span class="cline-any cline-no"> </span>
|
|
381
444
|
<span class="cline-any cline-no"> </span>
|
|
382
445
|
<span class="cline-any cline-no"> </span>
|
|
383
|
-
<span class="cline-any cline-no"> </span>
|
|
384
446
|
<span class="cline-any cline-neutral"> </span>
|
|
385
447
|
<span class="cline-any cline-neutral"> </span>
|
|
386
448
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -445,6 +507,8 @@
|
|
|
445
507
|
<span class="cline-any cline-no"> </span>
|
|
446
508
|
<span class="cline-any cline-no"> </span>
|
|
447
509
|
<span class="cline-any cline-no"> </span>
|
|
510
|
+
<span class="cline-any cline-no"> </span>
|
|
511
|
+
<span class="cline-any cline-neutral"> </span>
|
|
448
512
|
<span class="cline-any cline-neutral"> </span>
|
|
449
513
|
<span class="cline-any cline-neutral"> </span>
|
|
450
514
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -461,6 +525,9 @@
|
|
|
461
525
|
<span class="cline-any cline-no"> </span>
|
|
462
526
|
<span class="cline-any cline-no"> </span>
|
|
463
527
|
<span class="cline-any cline-no"> </span>
|
|
528
|
+
<span class="cline-any cline-neutral"> </span>
|
|
529
|
+
<span class="cline-any cline-neutral"> </span>
|
|
530
|
+
<span class="cline-any cline-neutral"> </span>
|
|
464
531
|
<span class="cline-any cline-no"> </span>
|
|
465
532
|
<span class="cline-any cline-no"> </span>
|
|
466
533
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -479,6 +546,8 @@
|
|
|
479
546
|
<span class="cline-any cline-neutral"> </span>
|
|
480
547
|
<span class="cline-any cline-neutral"> </span>
|
|
481
548
|
<span class="cline-any cline-neutral"> </span>
|
|
549
|
+
<span class="cline-any cline-neutral"> </span>
|
|
550
|
+
<span class="cline-any cline-neutral"> </span>
|
|
482
551
|
<span class="cline-any cline-no"> </span>
|
|
483
552
|
<span class="cline-any cline-no"> </span>
|
|
484
553
|
<span class="cline-any cline-no"> </span>
|
|
@@ -490,19 +559,21 @@
|
|
|
490
559
|
<span class="cline-any cline-no"> </span>
|
|
491
560
|
<span class="cline-any cline-no"> </span>
|
|
492
561
|
<span class="cline-any cline-no"> </span>
|
|
493
|
-
<span class="cline-any cline-no"> </span>
|
|
494
|
-
<span class="cline-any cline-neutral"> </span>
|
|
495
|
-
<span class="cline-any cline-neutral"> </span>
|
|
496
562
|
<span class="cline-any cline-neutral"> </span>
|
|
497
563
|
<span class="cline-any cline-no"> </span>
|
|
498
564
|
<span class="cline-any cline-no"> </span>
|
|
565
|
+
<span class="cline-any cline-neutral"> </span>
|
|
566
|
+
<span class="cline-any cline-no"> </span>
|
|
499
567
|
<span class="cline-any cline-no"> </span>
|
|
568
|
+
<span class="cline-any cline-neutral"> </span>
|
|
500
569
|
<span class="cline-any cline-no"> </span>
|
|
501
570
|
<span class="cline-any cline-no"> </span>
|
|
571
|
+
<span class="cline-any cline-neutral"> </span>
|
|
502
572
|
<span class="cline-any cline-no"> </span>
|
|
503
573
|
<span class="cline-any cline-no"> </span>
|
|
504
574
|
<span class="cline-any cline-neutral"> </span>
|
|
505
575
|
<span class="cline-any cline-neutral"> </span>
|
|
576
|
+
<span class="cline-any cline-neutral"> </span>
|
|
506
577
|
<span class="cline-any cline-no"> </span>
|
|
507
578
|
<span class="cline-any cline-neutral"> </span>
|
|
508
579
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -515,35 +586,49 @@
|
|
|
515
586
|
<span class="cline-any cline-neutral"> </span>
|
|
516
587
|
<span class="cline-any cline-neutral"> </span>
|
|
517
588
|
<span class="cline-any cline-neutral"> </span>
|
|
589
|
+
<span class="cline-any cline-neutral"> </span>
|
|
518
590
|
<span class="cline-any cline-no"> </span>
|
|
519
591
|
<span class="cline-any cline-neutral"> </span>
|
|
520
592
|
<span class="cline-any cline-neutral"> </span>
|
|
521
|
-
<span class="cline-any cline-
|
|
593
|
+
<span class="cline-any cline-yes">10x</span>
|
|
522
594
|
<span class="cline-any cline-neutral"> </span>
|
|
523
595
|
<span class="cline-any cline-neutral"> </span>
|
|
524
596
|
<span class="cline-any cline-neutral"> </span>
|
|
525
|
-
<span class="cline-any cline-
|
|
597
|
+
<span class="cline-any cline-yes">10x</span>
|
|
526
598
|
<span class="cline-any cline-neutral"> </span>
|
|
527
599
|
<span class="cline-any cline-neutral"> </span>
|
|
528
600
|
<span class="cline-any cline-neutral"> </span>
|
|
529
601
|
<span class="cline-any cline-neutral"> </span>
|
|
530
602
|
<span class="cline-any cline-neutral"> </span>
|
|
531
603
|
<span class="cline-any cline-neutral"> </span>
|
|
532
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef, useEffect, useContext, useState, useCallback } from
|
|
533
|
-
import PropTypes from
|
|
604
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef, useEffect, useContext, useState, useCallback } from 'react';
|
|
605
|
+
import PropTypes from 'prop-types';
|
|
606
|
+
|
|
607
|
+
import MapContext from '../../contexts/MapContext';
|
|
608
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
609
|
+
import useMapState from '../../hooks/useMapState';
|
|
610
|
+
import MapLibreGlWrapper from '../MapLibreMap/lib/MapLibreGlWrapper';
|
|
534
611
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
612
|
+
export interface MapState {
|
|
613
|
+
lat?: number;
|
|
614
|
+
lng?: number;
|
|
615
|
+
zoom?: number;
|
|
616
|
+
bearing?: number;
|
|
617
|
+
pitch?: number;
|
|
618
|
+
layers?: {
|
|
619
|
+
visible: boolean;
|
|
620
|
+
id: string;
|
|
621
|
+
}[];
|
|
622
|
+
}
|
|
538
623
|
|
|
539
|
-
const getCurrentUrlParameters =
|
|
540
|
-
|
|
541
|
-
<span class="
|
|
624
|
+
const getCurrentUrlParameters = (): MapState => {
|
|
625
|
+
const currentParams = Object.fromEntries(new URLSearchParams(window.location.search));
|
|
626
|
+
currentParams.layers = JSON.parse(currentParams?.layers ? <span class="branch-0 cbranch-no" title="branch not covered" >currentParams.layers </span>: '[]');
|
|
542
627
|
|
|
543
|
-
|
|
628
|
+
return currentParams;
|
|
544
629
|
};
|
|
545
630
|
|
|
546
|
-
const initialUrlParams =
|
|
631
|
+
const initialUrlParams = getCurrentUrlParameters();
|
|
547
632
|
|
|
548
633
|
/**
|
|
549
634
|
* TODO: Add short & useful description
|
|
@@ -553,14 +638,27 @@ const initialUrlParams = <span class="cstat-no" title="statement not covered" >g
|
|
|
553
638
|
*
|
|
554
639
|
* @component
|
|
555
640
|
*/
|
|
556
|
-
|
|
641
|
+
|
|
642
|
+
export interface MlShareMapStateProps {
|
|
643
|
+
//
|
|
644
|
+
mapId?: string;
|
|
645
|
+
idPrefix?: string;
|
|
646
|
+
active?: boolean;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export interface LayerStatesInterface {
|
|
650
|
+
//
|
|
651
|
+
[key: string]: boolean;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
const MlShareMapState = <span class="fstat-no" title="function not covered" >(p</span>rops: MlShareMapStateProps) => {
|
|
557
655
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
558
656
|
const mapContext = <span class="cstat-no" title="statement not covered" >useContext(MapContext);</span>
|
|
559
657
|
const initializedRef = <span class="cstat-no" title="statement not covered" >useRef(false);</span>
|
|
560
|
-
const mapRef = <span class="cstat-no" title="statement not covered" >useRef(
|
|
561
|
-
const [map, setMap] = <span class="cstat-no" title="statement not covered" >useState(undefined);</span>
|
|
658
|
+
const mapRef = <span class="cstat-no" title="statement not covered" >useRef<MapLibreGlWrapper | undefined>();</span>
|
|
659
|
+
const [map, setMap] = <span class="cstat-no" title="statement not covered" >useState<MapLibreGlWrapper | undefined>(undefined);</span>
|
|
562
660
|
const layersFromUrlParamsRef = <span class="cstat-no" title="statement not covered" >useRef({});</span>
|
|
563
|
-
const componentId = <span class="cstat-no" title="statement not covered" >useRef((props.idPrefix ? props.idPrefix :
|
|
661
|
+
const componentId = <span class="cstat-no" title="statement not covered" >useRef((props.idPrefix ? props.idPrefix : 'MlShareMapState-') + uuidv4());</span>
|
|
564
662
|
const mapState = <span class="cstat-no" title="statement not covered" >useMapState({</span>
|
|
565
663
|
watch: {
|
|
566
664
|
viewport: false,
|
|
@@ -573,7 +671,7 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
573
671
|
});
|
|
574
672
|
|
|
575
673
|
const allStatesRestoredRef = <span class="cstat-no" title="statement not covered" >useRef(false);</span>
|
|
576
|
-
const layerStatesRestored = <span class="cstat-no" title="statement not covered" >useRef(
|
|
674
|
+
const layerStatesRestored = <span class="cstat-no" title="statement not covered" >useRef<LayerStatesInterface>();</span>
|
|
577
675
|
const restoredStatesRef = <span class="cstat-no" title="statement not covered" >useRef({</span>
|
|
578
676
|
viewport: {
|
|
579
677
|
center: false,
|
|
@@ -587,42 +685,42 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
587
685
|
});
|
|
588
686
|
|
|
589
687
|
// initial URL-Params
|
|
590
|
-
const mapStateRef = <span class="cstat-no" title="statement not covered" >useRef({});</span>
|
|
688
|
+
const mapStateRef = <span class="cstat-no" title="statement not covered" >useRef<MapState>({});</span>
|
|
591
689
|
|
|
592
690
|
const refreshUrlParameters = <span class="cstat-no" title="statement not covered" >useCallback(<span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
593
691
|
<span class="cstat-no" title="statement not covered" > if (!props.active) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
594
692
|
|
|
595
|
-
|
|
596
|
-
<span class="cstat-no" title="statement not covered" > for (
|
|
693
|
+
const mapLayers = <span class="cstat-no" title="statement not covered" >[];</span>
|
|
694
|
+
<span class="cstat-no" title="statement not covered" > for (const x in mapState.layers) {</span>
|
|
597
695
|
<span class="cstat-no" title="statement not covered" > mapLayers.push({</span>
|
|
598
|
-
id: mapState.layers[x]
|
|
599
|
-
type: mapState.layers[x]
|
|
600
|
-
visible: mapState.layers[x]
|
|
696
|
+
id: mapState.layers[x]?.id,
|
|
697
|
+
type: mapState.layers[x]?.type,
|
|
698
|
+
visible: mapState.layers[x]?.visible,
|
|
601
699
|
});
|
|
602
700
|
}
|
|
603
701
|
<span class="cstat-no" title="statement not covered" > refreshMapState();</span>
|
|
604
|
-
|
|
605
|
-
...getCurrentUrlParameters(),
|
|
606
|
-
...mapStateRef.current,
|
|
702
|
+
const urlParams = <span class="cstat-no" title="statement not covered" >new URLSearchParams({</span>
|
|
703
|
+
...(getCurrentUrlParameters() as Record<string, string>),
|
|
704
|
+
...(mapStateRef.current as Record<string, string>),
|
|
607
705
|
layers: JSON.stringify(mapLayers),
|
|
608
706
|
});
|
|
609
|
-
<span class="cstat-no" title="statement not covered" > JSON.parse(Object.fromEntries(urlParams).layers).forEach(<span class="fstat-no" title="function not covered" >(e</span>l) => {</span>
|
|
707
|
+
<span class="cstat-no" title="statement not covered" > JSON.parse(Object.fromEntries(urlParams).layers).forEach(<span class="fstat-no" title="function not covered" >(e</span>l: { id: number }) => {</span>
|
|
708
|
+
// is iD a number?
|
|
610
709
|
<span class="cstat-no" title="statement not covered" > layersFromUrlParamsRef.current[el.id] = false;</span>
|
|
611
710
|
});
|
|
612
711
|
|
|
613
|
-
|
|
614
|
-
<span class="cstat-no" title="statement not covered" > checkRestorationStates(mapState.layers);</span>
|
|
712
|
+
const currentParams = <span class="cstat-no" title="statement not covered" >new URLSearchParams(window.location.search);</span>
|
|
615
713
|
<span class="cstat-no" title="statement not covered" > if (urlParams.toString() !== currentParams.toString()) {</span>
|
|
616
714
|
<span class="cstat-no" title="statement not covered" > window.history.pushState(</span>
|
|
617
715
|
{ ...mapStateRef.current },
|
|
618
716
|
document.title,
|
|
619
|
-
|
|
717
|
+
'?' + urlParams.toString()
|
|
620
718
|
);
|
|
621
719
|
}
|
|
622
720
|
}, [mapState.layers, props.active]);
|
|
623
721
|
|
|
624
722
|
<span class="cstat-no" title="statement not covered" > useEffect(<span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
625
|
-
|
|
723
|
+
const _componentId = <span class="cstat-no" title="statement not covered" >componentId.current;</span>
|
|
626
724
|
|
|
627
725
|
<span class="cstat-no" title="statement not covered" > mapStateRef.current = getCurrentUrlParameters();</span>
|
|
628
726
|
|
|
@@ -650,12 +748,12 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
650
748
|
<span class="cstat-no" title="statement not covered" > useEffect(<span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
651
749
|
<span class="cstat-no" title="statement not covered" > if (!mapRef.current) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
652
750
|
|
|
653
|
-
|
|
751
|
+
const _refreshUrlParameters = <span class="cstat-no" title="statement not covered" >refreshUrlParameters;</span>
|
|
654
752
|
|
|
655
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current.on(
|
|
753
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current.on('moveend', _refreshUrlParameters, componentId.current);</span>
|
|
656
754
|
|
|
657
755
|
<span class="cstat-no" title="statement not covered" > return <span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
658
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current?.off(
|
|
756
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.off('moveend', _refreshUrlParameters);</span>
|
|
659
757
|
};
|
|
660
758
|
}, [refreshUrlParameters, map]);
|
|
661
759
|
|
|
@@ -674,14 +772,16 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
674
772
|
<span class="cstat-no" title="statement not covered" > useEffect(<span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
675
773
|
<span class="cstat-no" title="statement not covered" > if (!mapState?.layers?.length) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
676
774
|
|
|
677
|
-
<span class="cstat-no" title="statement not covered" > if (typeof layerStatesRestored.current ===
|
|
678
|
-
<span class="cstat-no" title="statement not covered" > layerStatesRestored.current =
|
|
679
|
-
<span class="cstat-no" title="statement not covered" > initialUrlParams?.layers
|
|
680
|
-
<span class="cstat-no" title="statement not covered" > layerStatesRestored.current[layer.id]
|
|
775
|
+
<span class="cstat-no" title="statement not covered" > if (typeof layerStatesRestored.current === 'undefined') {</span>
|
|
776
|
+
<span class="cstat-no" title="statement not covered" > layerStatesRestored.current = undefined;</span>
|
|
777
|
+
<span class="cstat-no" title="statement not covered" > initialUrlParams?.layers?.forEach(<span class="fstat-no" title="function not covered" >(l</span>ayer: { id: string }) => {</span>
|
|
778
|
+
<span class="cstat-no" title="statement not covered" > if (layerStatesRestored.current?.[layer.id]) {</span>
|
|
779
|
+
<span class="cstat-no" title="statement not covered" > layerStatesRestored.current[layer.id] = false;</span>
|
|
780
|
+
}
|
|
681
781
|
});
|
|
682
782
|
}
|
|
683
783
|
|
|
684
|
-
<span class="cstat-no" title="statement not covered" > for (
|
|
784
|
+
<span class="cstat-no" title="statement not covered" > for (const key in layerStatesRestored.current) {</span>
|
|
685
785
|
let _allDone = <span class="cstat-no" title="statement not covered" >true;</span>
|
|
686
786
|
<span class="cstat-no" title="statement not covered" > if (layerStatesRestored.current[key] === false) {</span>
|
|
687
787
|
<span class="cstat-no" title="statement not covered" > _allDone = false;</span>
|
|
@@ -693,11 +793,14 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
693
793
|
|
|
694
794
|
<span class="cstat-no" title="statement not covered" > if (initialUrlParams.layers) {</span>
|
|
695
795
|
<span class="cstat-no" title="statement not covered" > initialUrlParams.layers.forEach(<span class="fstat-no" title="function not covered" >(l</span>ayer) => {</span>
|
|
696
|
-
<span class="cstat-no" title="statement not covered" > if (
|
|
796
|
+
<span class="cstat-no" title="statement not covered" > if (</span>
|
|
797
|
+
mapRef.current?.map.getLayer(layer.id) && //number oder str?
|
|
798
|
+
layerStatesRestored.current?.[layer.id] === false
|
|
799
|
+
) {
|
|
697
800
|
<span class="cstat-no" title="statement not covered" > layerStatesRestored.current[layer.id] = true;</span>
|
|
698
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current</span>
|
|
801
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current.map</span>
|
|
699
802
|
?.getLayer(layer.id)
|
|
700
|
-
?.setLayoutProperty(
|
|
803
|
+
?.setLayoutProperty('visibility', layer.visible ? 'visible' : 'none');
|
|
701
804
|
}
|
|
702
805
|
});
|
|
703
806
|
}
|
|
@@ -712,28 +815,32 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
712
815
|
}
|
|
713
816
|
}, [props.active, map, mapState.layers]);
|
|
714
817
|
|
|
715
|
-
|
|
716
|
-
<span class="cstat-no" title="statement not covered" > mapStateRef.current.lat = mapRef.current.getCenter().lat;</span>
|
|
717
|
-
<span class="cstat-no" title="statement not covered" > mapStateRef.current.lng = mapRef.current.getCenter().lng;</span>
|
|
718
|
-
<span class="cstat-no" title="statement not covered" > mapStateRef.current.zoom = mapRef.current.getZoom();</span>
|
|
719
|
-
<span class="cstat-no" title="statement not covered" > mapStateRef.current.bearing = mapRef.current.getBearing();</span>
|
|
720
|
-
<span class="cstat-no" title="statement not covered" > mapStateRef.current.pitch = mapRef.current.getPitch();</span>
|
|
721
|
-
};
|
|
818
|
+
//ist .current?.map. richtig?
|
|
722
819
|
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
<span class="cstat-no" title="statement not covered" >
|
|
726
|
-
<span class="cstat-no" title="statement not covered" >
|
|
727
|
-
|
|
820
|
+
const refreshMapState = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
821
|
+
<span class="cstat-no" title="statement not covered" > mapStateRef.current.lat = mapRef.current?.map.getCenter().lat;</span>
|
|
822
|
+
<span class="cstat-no" title="statement not covered" > mapStateRef.current.lng = mapRef.current?.map.getCenter().lng;</span>
|
|
823
|
+
<span class="cstat-no" title="statement not covered" > mapStateRef.current.zoom = mapRef.current?.map.getZoom();</span>
|
|
824
|
+
<span class="cstat-no" title="statement not covered" > mapStateRef.current.bearing = mapRef.current?.map.getBearing();</span>
|
|
825
|
+
<span class="cstat-no" title="statement not covered" > mapStateRef.current.pitch = mapRef.current?.map.getPitch();</span>
|
|
728
826
|
};
|
|
729
827
|
|
|
730
828
|
const restoreViewportState = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >()</span> => {</span>
|
|
731
829
|
<span class="cstat-no" title="statement not covered" > if (!restoredStatesRef.current.viewport.center) {</span>
|
|
732
830
|
<span class="cstat-no" title="statement not covered" > restoredStatesRef.current.viewport.center = true;</span>
|
|
733
|
-
|
|
734
|
-
<span class="cstat-no" title="statement not covered" >
|
|
735
|
-
<span class="cstat-no" title="statement not covered" >
|
|
736
|
-
|
|
831
|
+
|
|
832
|
+
<span class="cstat-no" title="statement not covered" > if (mapStateRef.current.lng && mapStateRef.current.lat) {</span>
|
|
833
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.setCenter([mapStateRef.current.lng, mapStateRef.current.lat]);</span>
|
|
834
|
+
}
|
|
835
|
+
<span class="cstat-no" title="statement not covered" > if (mapStateRef.current.zoom) {</span>
|
|
836
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.setZoom(mapStateRef.current.zoom);</span>
|
|
837
|
+
}
|
|
838
|
+
<span class="cstat-no" title="statement not covered" > if (mapStateRef.current.bearing) {</span>
|
|
839
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.setBearing(mapStateRef.current.bearing);</span>
|
|
840
|
+
}
|
|
841
|
+
<span class="cstat-no" title="statement not covered" > if (mapStateRef.current.pitch) {</span>
|
|
842
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.setPitch(mapStateRef.current.pitch);</span>
|
|
843
|
+
}
|
|
737
844
|
}
|
|
738
845
|
|
|
739
846
|
<span class="cstat-no" title="statement not covered" > allStatesRestoredRef.current = true;</span>
|
|
@@ -741,7 +848,8 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
741
848
|
|
|
742
849
|
<span class="cstat-no" title="statement not covered" > window.onpopstate = <span class="fstat-no" title="function not covered" >(e</span>vent) => {</span>
|
|
743
850
|
<span class="cstat-no" title="statement not covered" > if (event.state && event.state.lng && event.state.lat && event.state.zoom) {</span>
|
|
744
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current.easeTo({</span>
|
|
851
|
+
<span class="cstat-no" title="statement not covered" > mapRef.current?.map.easeTo({</span>
|
|
852
|
+
// so möglich?
|
|
745
853
|
zoom: event.state.zoom,
|
|
746
854
|
center: [event.state.lng, event.state.lat],
|
|
747
855
|
});
|
|
@@ -749,13 +857,13 @@ const MlShareMapState = <span class="cstat-no" title="statement not covered" ><s
|
|
|
749
857
|
};
|
|
750
858
|
|
|
751
859
|
<span class="cstat-no" title="statement not covered" > return <></>;</span>
|
|
752
|
-
}
|
|
860
|
+
};;
|
|
753
861
|
|
|
754
|
-
|
|
862
|
+
MlShareMapState.defaultProps = {
|
|
755
863
|
mapId: undefined,
|
|
756
864
|
};
|
|
757
865
|
|
|
758
|
-
|
|
866
|
+
MlShareMapState.propTypes = {
|
|
759
867
|
/**
|
|
760
868
|
* Id of the target MapLibre instance in mapContext
|
|
761
869
|
*/
|
|
@@ -769,7 +877,7 @@ export default MlShareMapState;
|
|
|
769
877
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
770
878
|
Code coverage generated by
|
|
771
879
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
772
|
-
at 2023-01-
|
|
880
|
+
at 2023-01-30T08:41:54.902Z
|
|
773
881
|
</div>
|
|
774
882
|
<script src="../../../prettify.js"></script>
|
|
775
883
|
<script>
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">7.47% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>8/107</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">1.56% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>1/64</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">5.88% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>1/17</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">8% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>8/100</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
</tr>
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
|
-
<td class="file low" data-value="MlShareMapState.
|
|
83
|
-
<td data-value="
|
|
84
|
-
<div class="chart"><div class="cover-fill" style="width:
|
|
82
|
+
<td class="file low" data-value="MlShareMapState.tsx"><a href="MlShareMapState.tsx.html">MlShareMapState.tsx</a></td>
|
|
83
|
+
<td data-value="7.47" class="pic low">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 7%"></div><div class="cover-empty" style="width: 93%"></div></div>
|
|
85
85
|
</td>
|
|
86
|
-
<td data-value="
|
|
87
|
-
<td data-value="
|
|
88
|
-
<td data-value="
|
|
89
|
-
<td data-value="
|
|
90
|
-
<td data-value="
|
|
91
|
-
<td data-value="
|
|
92
|
-
<td data-value="
|
|
93
|
-
<td data-value="100" class="abs low">
|
|
86
|
+
<td data-value="7.47" class="pct low">7.47%</td>
|
|
87
|
+
<td data-value="107" class="abs low">8/107</td>
|
|
88
|
+
<td data-value="1.56" class="pct low">1.56%</td>
|
|
89
|
+
<td data-value="64" class="abs low">1/64</td>
|
|
90
|
+
<td data-value="5.88" class="pct low">5.88%</td>
|
|
91
|
+
<td data-value="17" class="abs low">1/17</td>
|
|
92
|
+
<td data-value="8" class="pct low">8%</td>
|
|
93
|
+
<td data-value="100" class="abs low">8/100</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 2023-01-
|
|
104
|
+
at 2023-01-30T08:41:54.902Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -199,7 +199,7 @@ export default function <span class="fstat-no" title="function not covered" >Pai
|
|
|
199
199
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
200
200
|
Code coverage generated by
|
|
201
201
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
202
|
-
at 2023-01-
|
|
202
|
+
at 2023-01-30T08:41:54.902Z
|
|
203
203
|
</div>
|
|
204
204
|
<script src="../../../../prettify.js"></script>
|
|
205
205
|
<script>
|