@mapcomponents/react-maplibre 0.1.13 → 0.1.17
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/storybook.yml +4 -2
- package/CHANGELOG.md +33 -0
- package/README.md +22 -6
- package/coverage/clover.xml +447 -460
- package/coverage/coverage-final.json +14 -14
- package/coverage/lcov-report/index.html +77 -78
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.js.html +2 -3
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +2 -3
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.js.html +2 -3
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +2 -3
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.js.html +2 -3
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +2 -3
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.js.html +112 -107
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +16 -17
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +2 -3
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js.html +142 -134
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +20 -21
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html +46 -152
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +20 -21
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.js.html +92 -30
- package/coverage/lcov-report/src/components/MlLayer/index.html +20 -21
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.js.html +2 -3
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +2 -3
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.js.html +2 -3
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +2 -3
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +3 -10
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +9 -82
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +10 -11
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +2 -3
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.js.html +6 -7
- package/coverage/lcov-report/src/components/MlMarker/index.html +6 -7
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.js.html +2 -3
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +2 -3
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.js.html +11 -15
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +8 -9
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +2 -3
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +2 -3
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +209 -18
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +10 -11
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +2 -3
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +2 -3
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +6 -25
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +6 -7
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +2 -3
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +2 -3
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.js.html +2 -3
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +2 -3
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.js.html +6 -19
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +8 -9
- package/coverage/lcov-report/src/hooks/index.html +35 -36
- package/coverage/lcov-report/src/hooks/useMap.js.html +81 -169
- package/coverage/lcov-report/src/hooks/useMapState.js.html +82 -125
- package/coverage/lcov-report/src/hooks/useWms.js.html +9 -22
- package/coverage/lcov-report/src/i18n.js.html +2 -3
- package/coverage/lcov-report/src/index.html +2 -3
- package/coverage/lcov-report/src/translations/english.js.html +2 -3
- package/coverage/lcov-report/src/translations/german.js.html +2 -3
- package/coverage/lcov-report/src/translations/index.html +2 -3
- package/coverage/lcov.info +891 -896
- package/dist/index.esm.js +941 -717
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +16 -14
- package/src/components/MlComponentTemplate/MlComponentTemplate.js +7 -32
- package/src/components/MlFollowGps/MlFollowGps.js +67 -65
- package/src/components/MlFollowGps/MlFollowGps.test.js +3 -5
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +91 -88
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +20 -6
- package/src/components/MlGeoJsonLayer/assets/sample_polygon_1.json +33 -0
- package/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.js +25 -0
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.js +22 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +21 -56
- package/src/components/MlLayer/MlLayer.js +26 -5
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +0 -2
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +3 -6
- package/src/components/MlLayerSwitcher/components/LayerBox.js +2 -26
- package/src/components/MlMarker/MlMarker.js +1 -1
- package/src/components/MlNavigationTools/MlNavigationTools.js +4 -5
- package/src/components/MlShareMapState/MlShareMapState.js +73 -9
- package/src/components/MlShareMapState/MlShareMapState.stories.js +22 -2
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +1 -3
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.js +1 -7
- package/src/components/MlWmsLoader/MlWmsLoader.js +0 -4
- package/src/hooks/useMap.js +33 -62
- package/src/hooks/useMapState.js +3 -17
- package/src/hooks/useWms.js +2 -7
- package/src/index.js +3 -0
- package/src/ui_components/ImageLoader.js +8 -3
- package/src/ui_components/Sidebar.js +1 -1
- package/src/ui_components/TopToolbar.js +0 -2
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">65.62% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>21/32</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">55.55% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>10/18</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">66.66% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>20/30</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -234,8 +234,9 @@
|
|
|
234
234
|
<a name='L169'></a><a href='#L169'>169</a>
|
|
235
235
|
<a name='L170'></a><a href='#L170'>170</a>
|
|
236
236
|
<a name='L171'></a><a href='#L171'>171</a>
|
|
237
|
-
<a name='L172'></a><a href='#L172'>172</a
|
|
238
|
-
<
|
|
237
|
+
<a name='L172'></a><a href='#L172'>172</a>
|
|
238
|
+
<a name='L173'></a><a href='#L173'>173</a>
|
|
239
|
+
<a name='L174'></a><a href='#L174'>174</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
239
240
|
<span class="cline-any cline-neutral"> </span>
|
|
240
241
|
<span class="cline-any cline-neutral"> </span>
|
|
241
242
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -257,30 +258,26 @@
|
|
|
257
258
|
<span class="cline-any cline-neutral"> </span>
|
|
258
259
|
<span class="cline-any cline-neutral"> </span>
|
|
259
260
|
<span class="cline-any cline-yes">1x</span>
|
|
261
|
+
<span class="cline-any cline-yes">9x</span>
|
|
260
262
|
<span class="cline-any cline-neutral"> </span>
|
|
261
|
-
<span class="cline-any cline-yes">
|
|
262
|
-
<span class="cline-any cline-yes">
|
|
263
|
-
<span class="cline-any cline-yes">
|
|
264
|
-
<span class="cline-any cline-yes">
|
|
265
|
-
<span class="cline-any cline-yes">7x</span>
|
|
266
|
-
<span class="cline-any cline-neutral"> </span>
|
|
267
|
-
<span class="cline-any cline-yes">7x</span>
|
|
268
|
-
<span class="cline-any cline-yes">7x</span>
|
|
269
|
-
<span class="cline-any cline-yes">7x</span>
|
|
270
|
-
<span class="cline-any cline-yes">7x</span>
|
|
263
|
+
<span class="cline-any cline-yes">9x</span>
|
|
264
|
+
<span class="cline-any cline-yes">9x</span>
|
|
265
|
+
<span class="cline-any cline-yes">9x</span>
|
|
266
|
+
<span class="cline-any cline-yes">9x</span>
|
|
271
267
|
<span class="cline-any cline-neutral"> </span>
|
|
272
|
-
<span class="cline-any cline-yes">
|
|
273
|
-
<span class="cline-any cline-yes">2x</span>
|
|
268
|
+
<span class="cline-any cline-yes">9x</span>
|
|
274
269
|
<span class="cline-any cline-neutral"> </span>
|
|
270
|
+
<span class="cline-any cline-yes">9x</span>
|
|
275
271
|
<span class="cline-any cline-yes">2x</span>
|
|
272
|
+
<span class="cline-any cline-no"> </span>
|
|
273
|
+
<span class="cline-any cline-no"> </span>
|
|
274
|
+
<span class="cline-any cline-no"> </span>
|
|
276
275
|
<span class="cline-any cline-neutral"> </span>
|
|
277
276
|
<span class="cline-any cline-neutral"> </span>
|
|
278
277
|
<span class="cline-any cline-neutral"> </span>
|
|
279
278
|
<span class="cline-any cline-neutral"> </span>
|
|
279
|
+
<span class="cline-any cline-yes">9x</span>
|
|
280
280
|
<span class="cline-any cline-neutral"> </span>
|
|
281
|
-
<span class="cline-any cline-neutral"> </span>
|
|
282
|
-
<span class="cline-any cline-no"> </span>
|
|
283
|
-
<span class="cline-any cline-no"> </span>
|
|
284
281
|
<span class="cline-any cline-no"> </span>
|
|
285
282
|
<span class="cline-any cline-neutral"> </span>
|
|
286
283
|
<span class="cline-any cline-no"> </span>
|
|
@@ -291,29 +288,25 @@
|
|
|
291
288
|
<span class="cline-any cline-neutral"> </span>
|
|
292
289
|
<span class="cline-any cline-neutral"> </span>
|
|
293
290
|
<span class="cline-any cline-neutral"> </span>
|
|
294
|
-
<span class="cline-any cline-yes">
|
|
295
|
-
<span class="cline-any cline-
|
|
291
|
+
<span class="cline-any cline-yes">9x</span>
|
|
292
|
+
<span class="cline-any cline-no"> </span>
|
|
293
|
+
<span class="cline-any cline-no"> </span>
|
|
296
294
|
<span class="cline-any cline-neutral"> </span>
|
|
297
295
|
<span class="cline-any cline-neutral"> </span>
|
|
298
|
-
<span class="cline-any cline-yes">
|
|
299
|
-
<span class="cline-any cline-yes">
|
|
296
|
+
<span class="cline-any cline-yes">9x</span>
|
|
297
|
+
<span class="cline-any cline-yes">7x</span>
|
|
298
|
+
<span class="cline-any cline-neutral"> </span>
|
|
299
|
+
<span class="cline-any cline-yes">5x</span>
|
|
300
300
|
<span class="cline-any cline-yes">2x</span>
|
|
301
301
|
<span class="cline-any cline-neutral"> </span>
|
|
302
302
|
<span class="cline-any cline-neutral"> </span>
|
|
303
|
-
<span class="cline-any cline-yes">7x</span>
|
|
304
|
-
<span class="cline-any cline-no"> </span>
|
|
305
|
-
<span class="cline-any cline-no"> </span>
|
|
306
|
-
<span class="cline-any cline-no"> </span>
|
|
307
|
-
<span class="cline-any cline-no"> </span>
|
|
308
303
|
<span class="cline-any cline-neutral"> </span>
|
|
309
304
|
<span class="cline-any cline-neutral"> </span>
|
|
310
|
-
<span class="cline-any cline-yes">
|
|
311
|
-
<span class="cline-any cline-no"> </span>
|
|
312
|
-
<span class="cline-any cline-no"> </span>
|
|
305
|
+
<span class="cline-any cline-yes">3x</span>
|
|
313
306
|
<span class="cline-any cline-neutral"> </span>
|
|
314
307
|
<span class="cline-any cline-neutral"> </span>
|
|
315
|
-
<span class="cline-any cline-yes">7x</span>
|
|
316
308
|
<span class="cline-any cline-neutral"> </span>
|
|
309
|
+
<span class="cline-any cline-yes">9x</span>
|
|
317
310
|
<span class="cline-any cline-neutral"> </span>
|
|
318
311
|
<span class="cline-any cline-neutral"> </span>
|
|
319
312
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -351,6 +344,9 @@
|
|
|
351
344
|
<span class="cline-any cline-neutral"> </span>
|
|
352
345
|
<span class="cline-any cline-neutral"> </span>
|
|
353
346
|
<span class="cline-any cline-neutral"> </span>
|
|
347
|
+
<span class="cline-any cline-yes">3x</span>
|
|
348
|
+
<span class="cline-any cline-neutral"> </span>
|
|
349
|
+
<span class="cline-any cline-neutral"> </span>
|
|
354
350
|
<span class="cline-any cline-neutral"> </span>
|
|
355
351
|
<span class="cline-any cline-neutral"> </span>
|
|
356
352
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -358,15 +354,17 @@
|
|
|
358
354
|
<span class="cline-any cline-neutral"> </span>
|
|
359
355
|
<span class="cline-any cline-neutral"> </span>
|
|
360
356
|
<span class="cline-any cline-neutral"> </span>
|
|
361
|
-
<span class="cline-any cline-yes">3x</span>
|
|
362
357
|
<span class="cline-any cline-yes">1x</span>
|
|
363
358
|
<span class="cline-any cline-neutral"> </span>
|
|
364
|
-
<span class="cline-any cline-yes">2x</span>
|
|
365
359
|
<span class="cline-any cline-neutral"> </span>
|
|
366
360
|
<span class="cline-any cline-neutral"> </span>
|
|
367
361
|
<span class="cline-any cline-neutral"> </span>
|
|
368
362
|
<span class="cline-any cline-neutral"> </span>
|
|
369
|
-
<span class="cline-any cline-
|
|
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>
|
|
370
368
|
<span class="cline-any cline-neutral"> </span>
|
|
371
369
|
<span class="cline-any cline-neutral"> </span>
|
|
372
370
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -394,7 +392,6 @@
|
|
|
394
392
|
<span class="cline-any cline-neutral"> </span>
|
|
395
393
|
<span class="cline-any cline-neutral"> </span>
|
|
396
394
|
<span class="cline-any cline-neutral"> </span>
|
|
397
|
-
<span class="cline-any cline-yes">1x</span>
|
|
398
395
|
<span class="cline-any cline-neutral"> </span>
|
|
399
396
|
<span class="cline-any cline-neutral"> </span>
|
|
400
397
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -405,14 +402,20 @@
|
|
|
405
402
|
<span class="cline-any cline-neutral"> </span>
|
|
406
403
|
<span class="cline-any cline-neutral"> </span>
|
|
407
404
|
<span class="cline-any cline-neutral"> </span>
|
|
408
|
-
<span class="cline-any cline-neutral"> </span
|
|
405
|
+
<span class="cline-any cline-neutral"> </span>
|
|
406
|
+
<span class="cline-any cline-neutral"> </span>
|
|
407
|
+
<span class="cline-any cline-neutral"> </span>
|
|
408
|
+
<span class="cline-any cline-neutral"> </span>
|
|
409
|
+
<span class="cline-any cline-neutral"> </span>
|
|
410
|
+
<span class="cline-any cline-neutral"> </span>
|
|
411
|
+
<span class="cline-any cline-neutral"> </span>
|
|
412
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef, useEffect, useState, useCallback } from "react";
|
|
409
413
|
import PropTypes from "prop-types";
|
|
414
|
+
import useMap from "../../hooks/useMap";
|
|
410
415
|
|
|
411
|
-
import {MapContext} from "@mapcomponents/react-core";
|
|
412
|
-
import {v4 as uuidv4} from "uuid";
|
|
413
416
|
import Button from "@mui/material/Button";
|
|
414
417
|
import RoomIcon from "@mui/icons-material/Room";
|
|
415
|
-
import {point} from "@turf/turf"
|
|
418
|
+
import { point, circle } from "@turf/turf";
|
|
416
419
|
import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
|
|
417
420
|
import MlImageMarkerLayer from "../MlImageMarkerLayer/MlImageMarkerLayer";
|
|
418
421
|
|
|
@@ -428,88 +431,72 @@ import marker from "./assets/marker.png";
|
|
|
428
431
|
* @component
|
|
429
432
|
*/
|
|
430
433
|
const MlFollowGps = (props) => {
|
|
431
|
-
|
|
432
|
-
|
|
434
|
+
const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
435
|
+
|
|
433
436
|
const [isFollowed, setIsFollowed] = useState(false);
|
|
434
437
|
const [geoJson, setGeoJson] = useState(undefined);
|
|
435
438
|
const watchIdRef = useRef(undefined);
|
|
436
439
|
const [locationAccessDenied, setLocationAccessDenied] = useState(false);
|
|
437
440
|
|
|
438
|
-
const
|
|
439
|
-
const mapRef = useRef(undefined);
|
|
440
|
-
const componentId = useRef((props.idPrefix ? <span class="branch-0 cbranch-no" title="branch not covered" >props.idPrefix </span>: "MlFollowGps-") + uuidv4());
|
|
441
|
-
const [accuracyRadius, setAccuracyRadius] = useState(30);
|
|
441
|
+
const [accuracyGeoJson, setAccuracyGeoJson] = useState();
|
|
442
442
|
|
|
443
443
|
useEffect(() => {
|
|
444
|
-
let _componentId = componentId.current;
|
|
445
|
-
|
|
446
444
|
return <span class="fstat-no" title="function not covered" >()</span> => {
|
|
447
|
-
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
448
|
-
// try to remove anything this component has added to the MapLibre-gl instance
|
|
449
|
-
// e.g.: remove the layer
|
|
450
|
-
// mapContext.getMap(props.mapId).removeLayer(layerRef.current);
|
|
451
|
-
// check for the existence of map.style before calling getLayer or getSource
|
|
452
|
-
|
|
453
|
-
<span class="cstat-no" title="statement not covered" > if (mapRef.current) {</span>
|
|
454
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current.cleanup(_componentId);</span>
|
|
455
|
-
<span class="cstat-no" title="statement not covered" > mapRef.current = undefined;</span>
|
|
456
|
-
}
|
|
457
445
|
<span class="cstat-no" title="statement not covered" > if (watchIdRef.current) {</span>
|
|
458
|
-
<span class="cstat-no" title="statement not covered" > initializedRef.current = false;</span>
|
|
459
446
|
<span class="cstat-no" title="statement not covered" > navigator.geolocation.clearWatch(watchIdRef.current);</span>
|
|
460
447
|
<span class="cstat-no" title="statement not covered" > watchIdRef.current = undefined;</span>
|
|
461
448
|
}
|
|
462
449
|
};
|
|
463
450
|
}, []);
|
|
464
451
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
// initialize the layer and add it to the MapLibre-gl instance or do something else with it
|
|
469
|
-
initializedRef.current = true;
|
|
470
|
-
mapRef.current = mapContext.getMap(props.mapId);
|
|
471
|
-
mapRef.current.setCenter([7.132122000552613, 50.716405378037706]);
|
|
472
|
-
}, [mapContext.mapIds, mapContext, props.mapId]);
|
|
452
|
+
const getLocationSuccess = useCallback(
|
|
453
|
+
<span class="fstat-no" title="function not covered" > (p</span>os) => {
|
|
454
|
+
<span class="cstat-no" title="statement not covered" > if (!mapHook.map) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
473
455
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
<span class="cstat-no" title="statement not covered" >
|
|
477
|
-
<span class="cstat-no" title="statement not covered" >
|
|
478
|
-
|
|
479
|
-
|
|
456
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.setCenter([pos.coords.longitude, pos.coords.latitude]);</span>
|
|
457
|
+
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" > setGeoJson(geoJsonPoint);</span>
|
|
459
|
+
<span class="cstat-no" title="statement not covered" > setAccuracyGeoJson(circle(geoJsonPoint, pos.coords.accuracy / 1000));</span>
|
|
460
|
+
},
|
|
461
|
+
[mapHook.map]
|
|
462
|
+
);
|
|
480
463
|
|
|
481
464
|
const getLocationError = <span class="fstat-no" title="function not covered" >(e</span>rr) => {
|
|
482
465
|
<span class="cstat-no" title="statement not covered" > console.log("Access of user location denied");</span>
|
|
483
466
|
<span class="cstat-no" title="statement not covered" > setLocationAccessDenied(true);</span>
|
|
484
467
|
};
|
|
468
|
+
|
|
469
|
+
useEffect(() => {
|
|
470
|
+
if (!mapHook.map) return;
|
|
471
|
+
|
|
472
|
+
if (isFollowed) {
|
|
473
|
+
watchIdRef.current = navigator.geolocation.watchPosition(
|
|
474
|
+
getLocationSuccess,
|
|
475
|
+
getLocationError
|
|
476
|
+
);
|
|
477
|
+
} else {
|
|
478
|
+
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
479
|
+
}
|
|
480
|
+
}, [isFollowed, getLocationSuccess]);
|
|
485
481
|
|
|
486
482
|
return (
|
|
487
483
|
<>
|
|
488
484
|
{isFollowed && geoJson && (
|
|
489
485
|
<span class="branch-2 cbranch-no" title="branch not covered" > <MlGeoJsonLayer</span>
|
|
490
|
-
geojson={
|
|
491
|
-
type={"
|
|
486
|
+
geojson={accuracyGeoJson}
|
|
487
|
+
type={"fill"}
|
|
492
488
|
paint={{
|
|
493
|
-
"
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
[
|
|
497
|
-
20,
|
|
498
|
-
accuracyRadius /
|
|
499
|
-
0.075 /
|
|
500
|
-
Math.cos((geoJson.geometry.coordinates[1] * Math.PI) / 180),
|
|
501
|
-
],
|
|
502
|
-
],
|
|
503
|
-
base: 2,
|
|
504
|
-
},
|
|
505
|
-
"circle-color": "#ee7700",
|
|
506
|
-
"circle-opacity": 0.5,
|
|
489
|
+
"fill-color": "#ee7700",
|
|
490
|
+
"fill-opacity": 0.5,
|
|
491
|
+
...props.accuracyPaint,
|
|
507
492
|
}}
|
|
493
|
+
insertBeforeLayer={"MlFollowGpsMarker"}
|
|
508
494
|
/>
|
|
509
495
|
)}
|
|
510
496
|
|
|
511
497
|
{isFollowed && geoJson && (
|
|
512
498
|
<span class="branch-2 cbranch-no" title="branch not covered" > <MlImageMarkerLayer</span>
|
|
499
|
+
layerId={"MlFollowGpsMarker"}
|
|
513
500
|
options={{
|
|
514
501
|
type: "symbol",
|
|
515
502
|
source: {
|
|
@@ -519,29 +506,22 @@ const MlFollowGps = (props) => {
|
|
|
519
506
|
layout: {
|
|
520
507
|
"icon-size": 0.1,
|
|
521
508
|
"icon-offset": [0, -340],
|
|
509
|
+
...props.markerLayout,
|
|
522
510
|
},
|
|
523
511
|
}}
|
|
524
|
-
imgSrc={marker}
|
|
512
|
+
imgSrc={props.markerImage || marker}
|
|
525
513
|
/>
|
|
526
514
|
)}
|
|
527
515
|
|
|
528
516
|
<Button
|
|
529
|
-
sx={{ zIndex: 1002, color: isFollowed ?
|
|
517
|
+
sx={{ zIndex: 1002, color: isFollowed ? props.onColor : props.offColor, ...props.style }}
|
|
530
518
|
disabled={locationAccessDenied}
|
|
531
519
|
onClick={() => {
|
|
532
|
-
if (isFollowed) {
|
|
533
|
-
navigator.geolocation.clearWatch(watchIdRef.current);
|
|
534
|
-
} else {
|
|
535
|
-
watchIdRef.current = navigator.geolocation.watchPosition(
|
|
536
|
-
getLocationSuccess,
|
|
537
|
-
getLocationError
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
520
|
setIsFollowed(!isFollowed);
|
|
541
521
|
}}
|
|
542
522
|
>
|
|
543
523
|
{" "}
|
|
544
|
-
<RoomIcon sx={{fontSize: props.style.fontSize}}/>{" "}
|
|
524
|
+
<RoomIcon sx={{ fontSize: props.style.fontSize }} />{" "}
|
|
545
525
|
</Button>
|
|
546
526
|
</>
|
|
547
527
|
);
|
|
@@ -563,6 +543,8 @@ MlFollowGps.defaultProps = {
|
|
|
563
543
|
color: "#ececec",
|
|
564
544
|
},
|
|
565
545
|
},
|
|
546
|
+
onColor: "#ececec",
|
|
547
|
+
offColor: "#666",
|
|
566
548
|
};
|
|
567
549
|
|
|
568
550
|
MlFollowGps.propTypes = {
|
|
@@ -574,6 +556,30 @@ MlFollowGps.propTypes = {
|
|
|
574
556
|
* CSS style object that is applied to the button component
|
|
575
557
|
*/
|
|
576
558
|
style: PropTypes.object,
|
|
559
|
+
/**
|
|
560
|
+
* Active button font color
|
|
561
|
+
*/
|
|
562
|
+
onColor: PropTypes.string,
|
|
563
|
+
/**
|
|
564
|
+
* Inactive button font color
|
|
565
|
+
*/
|
|
566
|
+
offColor: PropTypes.string,
|
|
567
|
+
/**
|
|
568
|
+
* Accuracy paint property object, that is passed to the MlGeoJsonLayer responsible for drawing the accuracy circle.
|
|
569
|
+
* Use any available paint prop from layer type "fill".
|
|
570
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
571
|
+
*/
|
|
572
|
+
accuracyPaint: PropTypes.object,
|
|
573
|
+
/**
|
|
574
|
+
* Marker layout property object, that is passed to the MlImageMarkerLayer responsible for drawing the position marker.
|
|
575
|
+
* Use any available layout property from layer type "symbol".
|
|
576
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#symbol
|
|
577
|
+
*/
|
|
578
|
+
markerLayout: PropTypes.object,
|
|
579
|
+
/**
|
|
580
|
+
* Replace the default marker image with a custom one.
|
|
581
|
+
*/
|
|
582
|
+
markerImage: PropTypes.string,
|
|
577
583
|
};
|
|
578
584
|
export default MlFollowGps;
|
|
579
585
|
</pre></td></tr></table></pre>
|
|
@@ -582,10 +588,9 @@ export default MlFollowGps;
|
|
|
582
588
|
</div><!-- /wrapper -->
|
|
583
589
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
584
590
|
Code coverage generated by
|
|
585
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
586
|
-
at
|
|
591
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
592
|
+
at Sun Jan 09 2022 17:13:08 GMT+0000 (Coordinated Universal Time)
|
|
587
593
|
</div>
|
|
588
|
-
</div>
|
|
589
594
|
<script src="../../../prettify.js"></script>
|
|
590
595
|
<script>
|
|
591
596
|
window.onload = function () {
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">65.62% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>21/32</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">55.55% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>10/18</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">66.66% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>20/30</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="65.62" class="pic medium">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 65%"></div><div class="cover-empty" style="width: 35%"></div></div>
|
|
85
85
|
</td>
|
|
86
|
-
<td data-value="
|
|
87
|
-
<td data-value="
|
|
88
|
-
<td data-value="
|
|
89
|
-
<td data-value="
|
|
86
|
+
<td data-value="65.62" class="pct medium">65.62%</td>
|
|
87
|
+
<td data-value="32" class="abs medium">21/32</td>
|
|
88
|
+
<td data-value="55.55" class="pct medium">55.55%</td>
|
|
89
|
+
<td data-value="18" class="abs medium">10/18</td>
|
|
90
90
|
<td data-value="57.14" class="pct medium">57.14%</td>
|
|
91
91
|
<td data-value="7" class="abs medium">4/7</td>
|
|
92
|
-
<td data-value="
|
|
93
|
-
<td data-value="
|
|
92
|
+
<td data-value="66.66" class="pct medium">66.66%</td>
|
|
93
|
+
<td data-value="30" class="abs medium">20/30</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
</tbody>
|
|
@@ -100,10 +100,9 @@
|
|
|
100
100
|
</div><!-- /wrapper -->
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
104
|
-
at
|
|
103
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
+
at Sun Jan 09 2022 17:13:08 GMT+0000 (Coordinated Universal Time)
|
|
105
105
|
</div>
|
|
106
|
-
</div>
|
|
107
106
|
<script src="../../../prettify.js"></script>
|
|
108
107
|
<script>
|
|
109
108
|
window.onload = function () {
|
|
@@ -1182,10 +1182,9 @@ export default MlGPXViewer;
|
|
|
1182
1182
|
</div><!-- /wrapper -->
|
|
1183
1183
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1184
1184
|
Code coverage generated by
|
|
1185
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
1186
|
-
at
|
|
1185
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1186
|
+
at Sun Jan 09 2022 17:13:08 GMT+0000 (Coordinated Universal Time)
|
|
1187
1187
|
</div>
|
|
1188
|
-
</div>
|
|
1189
1188
|
<script src="../../../prettify.js"></script>
|
|
1190
1189
|
<script>
|
|
1191
1190
|
window.onload = function () {
|
|
@@ -1629,10 +1629,9 @@ export default toGeoJSON;
|
|
|
1629
1629
|
</div><!-- /wrapper -->
|
|
1630
1630
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1631
1631
|
Code coverage generated by
|
|
1632
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
1633
|
-
at
|
|
1632
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1633
|
+
at Sun Jan 09 2022 17:13:08 GMT+0000 (Coordinated Universal Time)
|
|
1634
1634
|
</div>
|
|
1635
|
-
</div>
|
|
1636
1635
|
<script src="../../../prettify.js"></script>
|
|
1637
1636
|
<script>
|
|
1638
1637
|
window.onload = function () {
|
|
@@ -115,10 +115,9 @@
|
|
|
115
115
|
</div><!-- /wrapper -->
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
119
|
-
at
|
|
118
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
+
at Sun Jan 09 2022 17:13:08 GMT+0000 (Coordinated Universal Time)
|
|
120
120
|
</div>
|
|
121
|
-
</div>
|
|
122
121
|
<script src="../../../prettify.js"></script>
|
|
123
122
|
<script>
|
|
124
123
|
window.onload = function () {
|