@mapcomponents/react-maplibre 0.1.24 → 0.1.28
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/CHANGELOG.md +72 -7
- package/coverage/clover.xml +461 -489
- package/coverage/coverage-final.json +21 -20
- package/coverage/lcov-report/index.html +94 -79
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.js.html +22 -22
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.js.html +11 -11
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +11 -11
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.js.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +4 -4
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.js.html +212 -77
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +19 -19
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.js.html +129 -165
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +8 -8
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +20 -20
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js.html +45 -297
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.js.html +2 -2
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.js.html +4 -4
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.js.html +3 -3
- 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.js.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.js.html +38 -104
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +19 -19
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.js.html +40 -139
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +32 -155
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +39 -198
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +9 -9
- 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/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +4 -4
- 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/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.js.html +580 -0
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +116 -0
- 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.js.html +3 -3
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- 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.js.html +8 -11
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +6 -6
- package/coverage/lcov-report/src/hooks/useMap.js.html +38 -26
- package/coverage/lcov-report/src/hooks/useMapState.js.html +47 -38
- package/coverage/lcov-report/src/hooks/useWms.js.html +2 -2
- package/coverage/lcov-report/src/i18n.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/translations/english.js.html +1 -1
- package/coverage/lcov-report/src/translations/german.js.html +1 -1
- package/coverage/lcov-report/src/translations/index.html +1 -1
- package/coverage/lcov.info +826 -882
- package/dist/index.esm.js +288 -517
- package/dist/index.esm.js.map +1 -1
- package/jsdoc.json +3 -3
- package/package.json +9 -9
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +5 -1
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +3 -3
- package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +2 -2
- package/src/components/MlFollowGps/MlFollowGps.js +99 -54
- package/src/components/MlFollowGps/MlFollowGps.test.js +1 -1
- package/src/components/MlGPXViewer/MlGPXViewer.js +69 -81
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +6 -90
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +4 -22
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.js +2 -2
- package/src/components/MlNavigationCompass/MlNavigationCompass.js +17 -39
- package/src/components/MlNavigationCompass/MlNavigationCompass.test.js +3 -3
- package/src/components/MlNavigationTools/MlNavigationTools.js +30 -63
- package/src/components/MlOsmLayer/MlOsmLayer.js +15 -56
- package/src/components/MlOsmLayer/MlOsmLayer.stories.js +21 -10
- package/src/components/MlOsmLayer/MlOsmLayer.test.js +4 -4
- package/src/components/MlScaleReference/MlScaleReference.js +29 -82
- package/src/components/MlShareMapState/MlShareMapState.stories.js +1 -3
- package/src/components/MlThreeJsLayer/lib/GLTFLoader.js +2369 -2591
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.doc.de.md +3 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.js +165 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +15 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +52 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.test.js +20 -0
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_1.json +26 -0
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_2.json +22 -0
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_polygon_1.json +33 -0
- package/src/components/{MlGeoJsonLayer → MlTransitionGeoJsonLayer}/util/transitionFunctions.js +63 -97
- package/src/components/MlWmsLayer/MlWmsLayer.js +1 -2
- package/src/decorators/MapContextDecorator.js +5 -0
- package/src/decorators/MultiMapContextDecorator.js +6 -0
- package/src/hooks/useMap.js +8 -4
- package/src/hooks/useMapState.js +4 -1
- package/src/hooks/useWms.js +1 -1
- package/dist/b556faa3bc6829d2.png +0 -0
- package/src/components/MlFollowGps/assets/marker.png +0 -0
- package/src/decorators/EmptyMapContextDecorator.js +0 -25
- package/src/decorators/MapContext3DDecorator.js +0 -39
- package/src/decorators/MapContextDashboardDecorator.js +0 -19
- package/src/decorators/MapContextKlokantechBasicDecorator.js +0 -39
|
@@ -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">60% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>30/50</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">65.21% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>15/23</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">70% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>7/10</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">61.7% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>29/47</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -236,7 +236,52 @@
|
|
|
236
236
|
<a name='L171'></a><a href='#L171'>171</a>
|
|
237
237
|
<a name='L172'></a><a href='#L172'>172</a>
|
|
238
238
|
<a name='L173'></a><a href='#L173'>173</a>
|
|
239
|
-
<a name='L174'></a><a href='#L174'>174</a
|
|
239
|
+
<a name='L174'></a><a href='#L174'>174</a>
|
|
240
|
+
<a name='L175'></a><a href='#L175'>175</a>
|
|
241
|
+
<a name='L176'></a><a href='#L176'>176</a>
|
|
242
|
+
<a name='L177'></a><a href='#L177'>177</a>
|
|
243
|
+
<a name='L178'></a><a href='#L178'>178</a>
|
|
244
|
+
<a name='L179'></a><a href='#L179'>179</a>
|
|
245
|
+
<a name='L180'></a><a href='#L180'>180</a>
|
|
246
|
+
<a name='L181'></a><a href='#L181'>181</a>
|
|
247
|
+
<a name='L182'></a><a href='#L182'>182</a>
|
|
248
|
+
<a name='L183'></a><a href='#L183'>183</a>
|
|
249
|
+
<a name='L184'></a><a href='#L184'>184</a>
|
|
250
|
+
<a name='L185'></a><a href='#L185'>185</a>
|
|
251
|
+
<a name='L186'></a><a href='#L186'>186</a>
|
|
252
|
+
<a name='L187'></a><a href='#L187'>187</a>
|
|
253
|
+
<a name='L188'></a><a href='#L188'>188</a>
|
|
254
|
+
<a name='L189'></a><a href='#L189'>189</a>
|
|
255
|
+
<a name='L190'></a><a href='#L190'>190</a>
|
|
256
|
+
<a name='L191'></a><a href='#L191'>191</a>
|
|
257
|
+
<a name='L192'></a><a href='#L192'>192</a>
|
|
258
|
+
<a name='L193'></a><a href='#L193'>193</a>
|
|
259
|
+
<a name='L194'></a><a href='#L194'>194</a>
|
|
260
|
+
<a name='L195'></a><a href='#L195'>195</a>
|
|
261
|
+
<a name='L196'></a><a href='#L196'>196</a>
|
|
262
|
+
<a name='L197'></a><a href='#L197'>197</a>
|
|
263
|
+
<a name='L198'></a><a href='#L198'>198</a>
|
|
264
|
+
<a name='L199'></a><a href='#L199'>199</a>
|
|
265
|
+
<a name='L200'></a><a href='#L200'>200</a>
|
|
266
|
+
<a name='L201'></a><a href='#L201'>201</a>
|
|
267
|
+
<a name='L202'></a><a href='#L202'>202</a>
|
|
268
|
+
<a name='L203'></a><a href='#L203'>203</a>
|
|
269
|
+
<a name='L204'></a><a href='#L204'>204</a>
|
|
270
|
+
<a name='L205'></a><a href='#L205'>205</a>
|
|
271
|
+
<a name='L206'></a><a href='#L206'>206</a>
|
|
272
|
+
<a name='L207'></a><a href='#L207'>207</a>
|
|
273
|
+
<a name='L208'></a><a href='#L208'>208</a>
|
|
274
|
+
<a name='L209'></a><a href='#L209'>209</a>
|
|
275
|
+
<a name='L210'></a><a href='#L210'>210</a>
|
|
276
|
+
<a name='L211'></a><a href='#L211'>211</a>
|
|
277
|
+
<a name='L212'></a><a href='#L212'>212</a>
|
|
278
|
+
<a name='L213'></a><a href='#L213'>213</a>
|
|
279
|
+
<a name='L214'></a><a href='#L214'>214</a>
|
|
280
|
+
<a name='L215'></a><a href='#L215'>215</a>
|
|
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></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
240
285
|
<span class="cline-any cline-neutral"> </span>
|
|
241
286
|
<span class="cline-any cline-neutral"> </span>
|
|
242
287
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -254,21 +299,26 @@
|
|
|
254
299
|
<span class="cline-any cline-neutral"> </span>
|
|
255
300
|
<span class="cline-any cline-neutral"> </span>
|
|
256
301
|
<span class="cline-any cline-neutral"> </span>
|
|
257
|
-
<span class="cline-any cline-
|
|
258
|
-
<span class="cline-any cline-neutral"> </span>
|
|
259
|
-
<span class="cline-any cline-neutral"> </span>
|
|
260
|
-
<span class="cline-any cline-yes">1x</span>
|
|
302
|
+
<span class="cline-any cline-yes">2x</span>
|
|
261
303
|
<span class="cline-any cline-yes">9x</span>
|
|
262
304
|
<span class="cline-any cline-neutral"> </span>
|
|
263
305
|
<span class="cline-any cline-yes">9x</span>
|
|
264
306
|
<span class="cline-any cline-yes">9x</span>
|
|
265
307
|
<span class="cline-any cline-yes">9x</span>
|
|
266
308
|
<span class="cline-any cline-yes">9x</span>
|
|
267
|
-
<span class="cline-any cline-neutral"> </span>
|
|
268
309
|
<span class="cline-any cline-yes">9x</span>
|
|
269
310
|
<span class="cline-any cline-neutral"> </span>
|
|
270
311
|
<span class="cline-any cline-yes">9x</span>
|
|
271
|
-
<span class="cline-any cline-
|
|
312
|
+
<span class="cline-any cline-neutral"> </span>
|
|
313
|
+
<span class="cline-any cline-no"> </span>
|
|
314
|
+
<span class="cline-any cline-neutral"> </span>
|
|
315
|
+
<span class="cline-any cline-no"> </span>
|
|
316
|
+
<span class="cline-any cline-neutral"> </span>
|
|
317
|
+
<span class="cline-any cline-neutral"> </span>
|
|
318
|
+
<span class="cline-any cline-neutral"> </span>
|
|
319
|
+
<span class="cline-any cline-neutral"> </span>
|
|
320
|
+
<span class="cline-any cline-neutral"> </span>
|
|
321
|
+
<span class="cline-any cline-no"> </span>
|
|
272
322
|
<span class="cline-any cline-no"> </span>
|
|
273
323
|
<span class="cline-any cline-no"> </span>
|
|
274
324
|
<span class="cline-any cline-no"> </span>
|
|
@@ -277,20 +327,39 @@
|
|
|
277
327
|
<span class="cline-any cline-neutral"> </span>
|
|
278
328
|
<span class="cline-any cline-neutral"> </span>
|
|
279
329
|
<span class="cline-any cline-yes">9x</span>
|
|
280
|
-
<span class="cline-any cline-neutral"> </span>
|
|
281
330
|
<span class="cline-any cline-no"> </span>
|
|
331
|
+
<span class="cline-any cline-no"> </span>
|
|
332
|
+
<span class="cline-any cline-neutral"> </span>
|
|
333
|
+
<span class="cline-any cline-neutral"> </span>
|
|
334
|
+
<span class="cline-any cline-yes">9x</span>
|
|
335
|
+
<span class="cline-any cline-neutral"> </span>
|
|
336
|
+
<span class="cline-any cline-yes">2x</span>
|
|
337
|
+
<span class="cline-any cline-yes">2x</span>
|
|
282
338
|
<span class="cline-any cline-neutral"> </span>
|
|
283
339
|
<span class="cline-any cline-no"> </span>
|
|
284
340
|
<span class="cline-any cline-no"> </span>
|
|
285
341
|
<span class="cline-any cline-no"> </span>
|
|
286
342
|
<span class="cline-any cline-no"> </span>
|
|
287
|
-
<span class="cline-any cline-
|
|
343
|
+
<span class="cline-any cline-no"> </span>
|
|
344
|
+
<span class="cline-any cline-no"> </span>
|
|
345
|
+
<span class="cline-any cline-no"> </span>
|
|
346
|
+
<span class="cline-any cline-no"> </span>
|
|
347
|
+
<span class="cline-any cline-no"> </span>
|
|
288
348
|
<span class="cline-any cline-neutral"> </span>
|
|
289
349
|
<span class="cline-any cline-neutral"> </span>
|
|
290
350
|
<span class="cline-any cline-neutral"> </span>
|
|
291
351
|
<span class="cline-any cline-yes">9x</span>
|
|
292
352
|
<span class="cline-any cline-no"> </span>
|
|
293
|
-
<span class="cline-any cline-
|
|
353
|
+
<span class="cline-any cline-neutral"> </span>
|
|
354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
355
|
+
<span class="cline-any cline-yes">9x</span>
|
|
356
|
+
<span class="cline-any cline-yes">5x</span>
|
|
357
|
+
<span class="cline-any cline-yes">2x</span>
|
|
358
|
+
<span class="cline-any cline-yes">2x</span>
|
|
359
|
+
<span class="cline-any cline-yes">2x</span>
|
|
360
|
+
<span class="cline-any cline-yes">1x</span>
|
|
361
|
+
<span class="cline-any cline-neutral"> </span>
|
|
362
|
+
<span class="cline-any cline-neutral"> </span>
|
|
294
363
|
<span class="cline-any cline-neutral"> </span>
|
|
295
364
|
<span class="cline-any cline-neutral"> </span>
|
|
296
365
|
<span class="cline-any cline-yes">9x</span>
|
|
@@ -299,14 +368,22 @@
|
|
|
299
368
|
<span class="cline-any cline-yes">5x</span>
|
|
300
369
|
<span class="cline-any cline-yes">2x</span>
|
|
301
370
|
<span class="cline-any cline-neutral"> </span>
|
|
371
|
+
<span class="cline-any cline-yes">2x</span>
|
|
372
|
+
<span class="cline-any cline-yes">1x</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-yes">9x</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>
|
|
302
381
|
<span class="cline-any cline-neutral"> </span>
|
|
303
382
|
<span class="cline-any cline-neutral"> </span>
|
|
304
383
|
<span class="cline-any cline-neutral"> </span>
|
|
305
|
-
<span class="cline-any cline-yes">3x</span>
|
|
306
384
|
<span class="cline-any cline-neutral"> </span>
|
|
307
385
|
<span class="cline-any cline-neutral"> </span>
|
|
308
386
|
<span class="cline-any cline-neutral"> </span>
|
|
309
|
-
<span class="cline-any cline-yes">9x</span>
|
|
310
387
|
<span class="cline-any cline-neutral"> </span>
|
|
311
388
|
<span class="cline-any cline-neutral"> </span>
|
|
312
389
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -354,7 +431,7 @@
|
|
|
354
431
|
<span class="cline-any cline-neutral"> </span>
|
|
355
432
|
<span class="cline-any cline-neutral"> </span>
|
|
356
433
|
<span class="cline-any cline-neutral"> </span>
|
|
357
|
-
<span class="cline-any cline-yes">
|
|
434
|
+
<span class="cline-any cline-yes">2x</span>
|
|
358
435
|
<span class="cline-any cline-neutral"> </span>
|
|
359
436
|
<span class="cline-any cline-neutral"> </span>
|
|
360
437
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -374,7 +451,12 @@
|
|
|
374
451
|
<span class="cline-any cline-neutral"> </span>
|
|
375
452
|
<span class="cline-any cline-neutral"> </span>
|
|
376
453
|
<span class="cline-any cline-neutral"> </span>
|
|
377
|
-
<span class="cline-any cline-
|
|
454
|
+
<span class="cline-any cline-neutral"> </span>
|
|
455
|
+
<span class="cline-any cline-neutral"> </span>
|
|
456
|
+
<span class="cline-any cline-neutral"> </span>
|
|
457
|
+
<span class="cline-any cline-yes">2x</span>
|
|
458
|
+
<span class="cline-any cline-neutral"> </span>
|
|
459
|
+
<span class="cline-any cline-neutral"> </span>
|
|
378
460
|
<span class="cline-any cline-neutral"> </span>
|
|
379
461
|
<span class="cline-any cline-neutral"> </span>
|
|
380
462
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -409,17 +491,22 @@
|
|
|
409
491
|
<span class="cline-any cline-neutral"> </span>
|
|
410
492
|
<span class="cline-any cline-neutral"> </span>
|
|
411
493
|
<span class="cline-any cline-neutral"> </span>
|
|
412
|
-
<span class="cline-any cline-neutral"> </span
|
|
494
|
+
<span class="cline-any cline-neutral"> </span>
|
|
495
|
+
<span class="cline-any cline-neutral"> </span>
|
|
496
|
+
<span class="cline-any cline-neutral"> </span>
|
|
497
|
+
<span class="cline-any cline-neutral"> </span>
|
|
498
|
+
<span class="cline-any cline-neutral"> </span>
|
|
499
|
+
<span class="cline-any cline-neutral"> </span>
|
|
500
|
+
<span class="cline-any cline-neutral"> </span>
|
|
501
|
+
<span class="cline-any cline-neutral"> </span>
|
|
502
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useEffect, useState, useCallback, useMemo } from "react";
|
|
413
503
|
import PropTypes from "prop-types";
|
|
414
504
|
import useMap from "../../hooks/useMap";
|
|
415
505
|
|
|
416
506
|
import Button from "@mui/material/Button";
|
|
417
|
-
import
|
|
418
|
-
import { point, circle } from "@turf/turf";
|
|
507
|
+
import GpsFixedIcon from "@mui/icons-material/GpsFixed";
|
|
508
|
+
import { point, circle, lineArc } from "@turf/turf";
|
|
419
509
|
import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
|
|
420
|
-
import MlImageMarkerLayer from "../MlImageMarkerLayer/MlImageMarkerLayer";
|
|
421
|
-
|
|
422
|
-
import marker from "./assets/marker.png";
|
|
423
510
|
|
|
424
511
|
/**
|
|
425
512
|
* Adds a button that makes the map follow the users GPS position using
|
|
@@ -434,82 +521,117 @@ const MlFollowGps = (props) => {
|
|
|
434
521
|
const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
435
522
|
|
|
436
523
|
const [isFollowed, setIsFollowed] = useState(false);
|
|
437
|
-
const [
|
|
438
|
-
const watchIdRef = useRef(undefined);
|
|
524
|
+
const [userLocationGeoJson, setUserLocationGeoJson] = useState(undefined);
|
|
439
525
|
const [locationAccessDenied, setLocationAccessDenied] = useState(false);
|
|
440
|
-
|
|
441
526
|
const [accuracyGeoJson, setAccuracyGeoJson] = useState();
|
|
442
|
-
|
|
443
|
-
useEffect(() => {
|
|
444
|
-
return <span class="fstat-no" title="function not covered" >()</span> => {
|
|
445
|
-
<span class="cstat-no" title="statement not covered" > if (watchIdRef.current) {</span>
|
|
446
|
-
<span class="cstat-no" title="statement not covered" > navigator.geolocation.clearWatch(watchIdRef.current);</span>
|
|
447
|
-
<span class="cstat-no" title="statement not covered" > watchIdRef.current = undefined;</span>
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
}, []);
|
|
527
|
+
const [deviceOrientation, setDeviceOrientation] = useState(0);
|
|
451
528
|
|
|
452
529
|
const getLocationSuccess = useCallback(
|
|
453
530
|
<span class="fstat-no" title="function not covered" > (p</span>os) => {
|
|
454
531
|
<span class="cstat-no" title="statement not covered" > if (!mapHook.map) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
455
532
|
|
|
456
|
-
<span class="cstat-no" title="statement not covered" > mapHook.map.
|
|
533
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.flyTo({</span>
|
|
534
|
+
center: [pos.coords.longitude, pos.coords.latitude],
|
|
535
|
+
zoom: 18,
|
|
536
|
+
speed: 1,
|
|
537
|
+
curve: 1,
|
|
538
|
+
});
|
|
539
|
+
<span class="cstat-no" title="statement not covered" > if (!props.showUserLocation) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
457
540
|
const geoJsonPoint = <span class="cstat-no" title="statement not covered" >point([pos.coords.longitude, pos.coords.latitude]);</span>
|
|
458
|
-
<span class="cstat-no" title="statement not covered" >
|
|
541
|
+
<span class="cstat-no" title="statement not covered" > setUserLocationGeoJson(geoJsonPoint);</span>
|
|
459
542
|
<span class="cstat-no" title="statement not covered" > setAccuracyGeoJson(circle(geoJsonPoint, pos.coords.accuracy / 1000));</span>
|
|
460
543
|
},
|
|
461
|
-
[mapHook.map]
|
|
544
|
+
[mapHook.map, props]
|
|
462
545
|
);
|
|
463
546
|
|
|
464
547
|
const getLocationError = <span class="fstat-no" title="function not covered" >(e</span>rr) => {
|
|
465
548
|
<span class="cstat-no" title="statement not covered" > console.log("Access of user location denied");</span>
|
|
466
549
|
<span class="cstat-no" title="statement not covered" > setLocationAccessDenied(true);</span>
|
|
467
550
|
};
|
|
551
|
+
|
|
552
|
+
const orientationCone = useMemo(
|
|
553
|
+
() => {
|
|
554
|
+
if (!userLocationGeoJson) {
|
|
555
|
+
return undefined;
|
|
556
|
+
}
|
|
557
|
+
let radius = <span class="cstat-no" title="statement not covered" >0.02;</span>
|
|
558
|
+
let bearing1 = <span class="cstat-no" title="statement not covered" >deviceOrientation - 15;</span>
|
|
559
|
+
let bearing2 = <span class="cstat-no" title="statement not covered" >deviceOrientation + 15;</span>
|
|
560
|
+
const options = <span class="cstat-no" title="statement not covered" >{steps: 65};</span>
|
|
561
|
+
let arc = <span class="cstat-no" title="statement not covered" >lineArc(userLocationGeoJson, radius, bearing1, bearing2, options);</span>
|
|
562
|
+
let copy = <span class="cstat-no" title="statement not covered" >arc;</span>
|
|
563
|
+
<span class="cstat-no" title="statement not covered" > copy.geometry.coordinates.push(userLocationGeoJson.geometry.coordinates);</span>
|
|
564
|
+
<span class="cstat-no" title="statement not covered" > copy.geometry.coordinates.slice(0, 0, userLocationGeoJson.geometry.coordinates);</span>
|
|
565
|
+
<span class="cstat-no" title="statement not covered" > return copy;</span>
|
|
566
|
+
}, [deviceOrientation, userLocationGeoJson]
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
const handleOrientation = <span class="fstat-no" title="function not covered" >(e</span>vent) => {
|
|
570
|
+
<span class="cstat-no" title="statement not covered" > setDeviceOrientation(-event.alpha)</span>
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
useEffect(() => {
|
|
574
|
+
if (isFollowed) {
|
|
575
|
+
let _handleOrientation = handleOrientation;
|
|
576
|
+
window.addEventListener('deviceorientation', _handleOrientation)
|
|
577
|
+
return () => {
|
|
578
|
+
window.removeEventListener('deviceorientation', _handleOrientation)
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}, [isFollowed]);
|
|
468
582
|
|
|
469
583
|
useEffect(() => {
|
|
470
584
|
if (!mapHook.map) return;
|
|
471
585
|
|
|
472
586
|
if (isFollowed) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
587
|
+
let _watchId = navigator.geolocation.watchPosition(getLocationSuccess, getLocationError);
|
|
588
|
+
|
|
589
|
+
return () => {
|
|
590
|
+
navigator.geolocation.clearWatch(_watchId);
|
|
591
|
+
};
|
|
479
592
|
}
|
|
480
|
-
}, [isFollowed, getLocationSuccess]);
|
|
593
|
+
}, [mapHook.map, isFollowed, getLocationSuccess]);
|
|
481
594
|
|
|
482
595
|
return (
|
|
483
596
|
<>
|
|
484
|
-
{isFollowed &&
|
|
597
|
+
{isFollowed && userLocationGeoJson && (
|
|
485
598
|
<span class="branch-2 cbranch-no" title="branch not covered" > <MlGeoJsonLayer</span>
|
|
486
599
|
geojson={accuracyGeoJson}
|
|
487
600
|
type={"fill"}
|
|
488
601
|
paint={{
|
|
489
|
-
"fill-color": "#
|
|
490
|
-
"fill-opacity": 0.
|
|
602
|
+
"fill-color": "#cbd300",
|
|
603
|
+
"fill-opacity": 0.3,
|
|
491
604
|
...props.accuracyPaint,
|
|
492
605
|
}}
|
|
493
|
-
insertBeforeLayer={
|
|
606
|
+
insertBeforeLayer={props.insertBeforeLayer}
|
|
494
607
|
/>
|
|
495
608
|
)}
|
|
496
609
|
|
|
497
|
-
{isFollowed &&
|
|
498
|
-
<span class="branch-2 cbranch-no" title="branch not covered" > <
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
},
|
|
506
|
-
layout: {
|
|
507
|
-
"icon-size": 0.1,
|
|
508
|
-
"icon-offset": [0, -340],
|
|
509
|
-
...props.markerLayout,
|
|
510
|
-
},
|
|
610
|
+
{isFollowed && orientationCone && (
|
|
611
|
+
<span class="branch-2 cbranch-no" title="branch not covered" > <MlGeoJsonLayer</span>
|
|
612
|
+
geojson={orientationCone}
|
|
613
|
+
type={"fill"}
|
|
614
|
+
paint={{
|
|
615
|
+
"fill-color": "#0000ff",
|
|
616
|
+
"fill-antialias": false,
|
|
617
|
+
"fill-opacity": 0.3,
|
|
511
618
|
}}
|
|
512
|
-
|
|
619
|
+
insertBeforeLayer={props.insertBeforeLayer}
|
|
620
|
+
/>
|
|
621
|
+
)}
|
|
622
|
+
|
|
623
|
+
{isFollowed && userLocationGeoJson && (
|
|
624
|
+
<span class="branch-2 cbranch-no" title="branch not covered" > <MlGeoJsonLayer</span>
|
|
625
|
+
geojson={userLocationGeoJson}
|
|
626
|
+
type={"circle"}
|
|
627
|
+
paint={{
|
|
628
|
+
"circle-color": "#009ee0",
|
|
629
|
+
"circle-radius": 5,
|
|
630
|
+
"circle-stroke-color": "#fafaff",
|
|
631
|
+
"circle-stroke-width": 1,
|
|
632
|
+
...props.circlePaint,
|
|
633
|
+
}}
|
|
634
|
+
insertBeforeLayer={props.insertBeforeLayer}
|
|
513
635
|
/>
|
|
514
636
|
)}
|
|
515
637
|
|
|
@@ -521,7 +643,7 @@ const MlFollowGps = (props) => {
|
|
|
521
643
|
}}
|
|
522
644
|
>
|
|
523
645
|
{" "}
|
|
524
|
-
<
|
|
646
|
+
<GpsFixedIcon sx={{ fontSize: props.style.fontSize }} />{" "}
|
|
525
647
|
</Button>
|
|
526
648
|
</>
|
|
527
649
|
);
|
|
@@ -545,6 +667,9 @@ MlFollowGps.defaultProps = {
|
|
|
545
667
|
},
|
|
546
668
|
onColor: "#ececec",
|
|
547
669
|
offColor: "#666",
|
|
670
|
+
showAccuracyCircle: true,
|
|
671
|
+
showUserLocation: true,
|
|
672
|
+
showOrientation: true
|
|
548
673
|
};
|
|
549
674
|
|
|
550
675
|
MlFollowGps.propTypes = {
|
|
@@ -571,15 +696,25 @@ MlFollowGps.propTypes = {
|
|
|
571
696
|
*/
|
|
572
697
|
accuracyPaint: PropTypes.object,
|
|
573
698
|
/**
|
|
574
|
-
*
|
|
575
|
-
* Use any available
|
|
576
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#
|
|
699
|
+
* position circle paint property object, that is passed to the MlGeoJsonLayer responsible for drawing the accuracy circle.
|
|
700
|
+
* Use any available paint prop from layer type "fill".
|
|
701
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
702
|
+
*/
|
|
703
|
+
circlePaint: PropTypes.object,
|
|
704
|
+
/**
|
|
705
|
+
* By default, if showUserLocation is true, a transparent circle will be drawn around the user location
|
|
706
|
+
* indicating the accuracy (95% confidence level) of the user's location. Set to false to disable.
|
|
707
|
+
*/
|
|
708
|
+
showAccuracyCircle: PropTypes.bool,
|
|
709
|
+
/**
|
|
710
|
+
* By default a dot will be shown on the map at the user's location. Set to false to disable.
|
|
577
711
|
*/
|
|
578
|
-
|
|
712
|
+
showUserLocation: PropTypes.bool,
|
|
579
713
|
/**
|
|
580
|
-
*
|
|
714
|
+
* By default a cone will be shown on the map at the user's location to indicate the device's orientation.
|
|
715
|
+
* Set to false to disable.
|
|
581
716
|
*/
|
|
582
|
-
|
|
717
|
+
showOrientation: PropTypes.bool,
|
|
583
718
|
};
|
|
584
719
|
export default MlFollowGps;
|
|
585
720
|
</pre></td></tr></table></pre>
|
|
@@ -589,7 +724,7 @@ export default MlFollowGps;
|
|
|
589
724
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
590
725
|
Code coverage generated by
|
|
591
726
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
592
|
-
at Sun
|
|
727
|
+
at Sun Feb 20 2022 13:39:56 GMT+0000 (Coordinated Universal Time)
|
|
593
728
|
</div>
|
|
594
729
|
<script src="../../../prettify.js"></script>
|
|
595
730
|
<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">60% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>30/50</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">65.21% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>15/23</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">70% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>7/10</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">61.7% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>29/47</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="MlFollowGps.js"><a href="MlFollowGps.js.html">MlFollowGps.js</a></td>
|
|
83
|
-
<td data-value="
|
|
84
|
-
<div class="chart"><div class="cover-fill" style="width:
|
|
83
|
+
<td data-value="60" class="pic medium">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 60%"></div><div class="cover-empty" style="width: 40%"></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="
|
|
86
|
+
<td data-value="60" class="pct medium">60%</td>
|
|
87
|
+
<td data-value="50" class="abs medium">30/50</td>
|
|
88
|
+
<td data-value="65.21" class="pct medium">65.21%</td>
|
|
89
|
+
<td data-value="23" class="abs medium">15/23</td>
|
|
90
|
+
<td data-value="70" class="pct medium">70%</td>
|
|
91
|
+
<td data-value="10" class="abs medium">7/10</td>
|
|
92
|
+
<td data-value="61.7" class="pct medium">61.7%</td>
|
|
93
|
+
<td data-value="47" class="abs medium">29/47</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 Sun
|
|
104
|
+
at Sun Feb 20 2022 13:39:56 GMT+0000 (Coordinated Universal Time)
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../../prettify.js"></script>
|
|
107
107
|
<script>
|