@mapcomponents/react-maplibre 0.1.12 → 0.1.16
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 +893 -760
- package/coverage/coverage-final.json +22 -17
- package/coverage/lcov-report/index.html +183 -123
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/MapLibreMap.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/MlFeatureEditor.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/MlFollowGps.js.html +148 -136
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/index.html +24 -24
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/MlGPXViewer.js.html +66 -60
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/gpxConverter.js.html +49 -70
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/index.html +25 -25
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.js.html +155 -47
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/index.html +28 -28
- package/coverage/lcov-report/{components/MlLayer/MlLayer.js.html → src/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html} +88 -121
- package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/index.html +28 -28
- package/coverage/lcov-report/{components/MlImageMarkerLayer/MlImageMarkerLayer.js.html → src/components/MlLayer/MlLayer.js.html} +116 -125
- package/coverage/lcov-report/src/components/MlLayer/index.html +117 -0
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/MlLayerMagnify.js.html +41 -41
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/index.html +24 -24
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/MlLayerSwipe.js.html +38 -41
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/index.html +24 -24
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +755 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +380 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +117 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +117 -0
- package/coverage/lcov-report/{components → src/components}/MlMarker/MlMarker.js.html +11 -11
- package/coverage/lcov-report/{components → src/components}/MlMarker/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/MlNavigationCompass.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/MlNavigationTools.js.html +50 -41
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/index.html +18 -18
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/MlOsmLayer.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/MlScaleReference.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/MlShareMapState.js.html +217 -25
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/index.html +18 -18
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.js.html +30 -54
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/index.html +24 -24
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/index.html +10 -10
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/MlWmsLayer.js.html +13 -13
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/index.html +14 -14
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/MlWmsLoader.js.html +31 -19
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/index.html +16 -16
- package/coverage/lcov-report/src/hooks/index.html +147 -0
- package/coverage/lcov-report/src/hooks/useMap.js.html +296 -0
- package/coverage/lcov-report/{hooks → src/hooks}/useMapState.js.html +91 -91
- package/coverage/lcov-report/{hooks → src/hooks}/useWms.js.html +18 -18
- package/coverage/lcov-report/src/i18n.js.html +167 -0
- package/coverage/lcov-report/src/index.html +117 -0
- package/coverage/lcov-report/src/translations/english.js.html +95 -0
- package/coverage/lcov-report/src/translations/german.js.html +95 -0
- package/coverage/lcov-report/src/translations/index.html +132 -0
- package/coverage/lcov.info +1610 -1314
- package/dist/b556faa3bc6829d2.png +0 -0
- package/dist/index.esm.js +934 -668
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -1
- package/public/assets/dop.png +0 -0
- package/public/assets/historic.png +0 -0
- package/public/assets/osm.png +0 -0
- package/public/thumbnails/MlFollowGps.png +0 -0
- package/public/thumbnails/MlThreeJsLayer.png +0 -0
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +53 -67
- package/src/components/MlComponentTemplate/MlComponentTemplate.js +6 -31
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -2
- package/src/components/MlFollowGps/MlFollowGps.js +92 -88
- package/src/components/MlFollowGps/MlFollowGps.meta.json +2 -2
- package/src/components/MlFollowGps/MlFollowGps.test.js +3 -5
- package/src/components/MlFollowGps/assets/marker.png +0 -0
- package/src/components/MlGPXViewer/MlGPXViewer.js +45 -43
- package/src/components/MlGPXViewer/gpxConverter.js +22 -29
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +45 -9
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +21 -57
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +6 -7
- package/src/components/MlLayer/MlLayer.js +28 -6
- package/src/components/MlLayer/MlLayer.test.js +12 -10
- package/src/components/MlLayerMagnify/MlLayerMagnify.js +3 -3
- package/src/components/MlLayerSwipe/MlLayerSwipe.js +4 -5
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.css +17 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.doc.de.md +3 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +223 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +15 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +106 -0
- package/src/components/MlLayerSwitcher/assets/sample_1.json +26 -0
- package/src/components/MlLayerSwitcher/assets/sample_2.json +22 -0
- package/src/components/MlLayerSwitcher/components/LayerBox.js +98 -0
- package/src/components/MlMarker/MlMarker.js +1 -1
- package/src/components/MlNavigationTools/MlNavigationTools.js +29 -26
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -1
- package/src/components/MlScaleReference/MlScaleReference.stories.js +25 -21
- package/src/components/MlShareMapState/MlShareMapState.js +73 -9
- package/src/components/MlShareMapState/MlShareMapState.stories.js +24 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +12 -6
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +8 -15
- package/src/components/MlWmsLayer/MlWmsLayer.js +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.js +8 -4
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +5 -4
- package/src/decorators/EmptyMapContextDecorator.js +11 -6
- package/src/decorators/MapContext3DDecorator.js +25 -20
- package/src/decorators/MapContextDashboardDecorator.js +7 -2
- package/src/decorators/MapContextDecorator.js +7 -3
- package/src/decorators/MapContextKlokantechBasicDecorator.js +8 -4
- package/src/decorators/MultiMapContextDecorator.js +2 -1
- package/src/hooks/useMap.js +33 -62
- package/src/hooks/useMapState.js +3 -3
- package/src/hooks/useWms.js +7 -6
- package/src/i18n.js +28 -0
- package/src/index.js +3 -0
- package/src/translations/english.js +4 -0
- package/src/translations/german.js +4 -0
- package/src/ui_components/ImageLoader.js +73 -0
- package/src/ui_components/Sidebar.js +75 -20
- package/src/ui_components/TopToolbar.js +18 -18
- package/coverage/lcov-report/components/MlLayer/index.html +0 -117
- package/coverage/lcov-report/hooks/index.html +0 -147
- package/coverage/lcov-report/hooks/useMap.js.html +0 -383
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for components/
|
|
6
|
+
<title>Code coverage report for src/components/MlImageMarkerLayer/MlImageMarkerLayer.js</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="
|
|
9
|
-
<link rel="stylesheet" href="
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="
|
|
8
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
11
11
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
12
|
<style type='text/css'>
|
|
13
13
|
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(
|
|
14
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
17
|
</head>
|
|
@@ -19,34 +19,34 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="
|
|
22
|
+
<h1><a href="../../../index.html">All files</a> / <a href="index.html">src/components/MlImageMarkerLayer</a> MlImageMarkerLayer.js</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">69.69% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>23/33</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">48.27% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>14/29</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">83.33% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>5/
|
|
42
|
+
<span class='fraction'>5/6</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">70.96% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>31
|
|
49
|
+
<span class='fraction'>22/31</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line medium'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -138,31 +138,13 @@
|
|
|
138
138
|
<a name='L73'></a><a href='#L73'>73</a>
|
|
139
139
|
<a name='L74'></a><a href='#L74'>74</a>
|
|
140
140
|
<a name='L75'></a><a href='#L75'>75</a>
|
|
141
|
-
<a name='L76'></a><a href='#L76'>76</a>
|
|
142
|
-
<a name='L77'></a><a href='#L77'>77</a>
|
|
143
|
-
<a name='L78'></a><a href='#L78'>78</a>
|
|
144
|
-
<a name='L79'></a><a href='#L79'>79</a>
|
|
145
|
-
<a name='L80'></a><a href='#L80'>80</a>
|
|
146
|
-
<a name='L81'></a><a href='#L81'>81</a>
|
|
147
|
-
<a name='L82'></a><a href='#L82'>82</a>
|
|
148
|
-
<a name='L83'></a><a href='#L83'>83</a>
|
|
149
|
-
<a name='L84'></a><a href='#L84'>84</a>
|
|
150
|
-
<a name='L85'></a><a href='#L85'>85</a>
|
|
151
|
-
<a name='L86'></a><a href='#L86'>86</a>
|
|
152
|
-
<a name='L87'></a><a href='#L87'>87</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
141
|
+
<a name='L76'></a><a href='#L76'>76</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
153
142
|
<span class="cline-any cline-neutral"> </span>
|
|
154
143
|
<span class="cline-any cline-neutral"> </span>
|
|
155
144
|
<span class="cline-any cline-neutral"> </span>
|
|
156
|
-
<span class="cline-any cline-
|
|
157
|
-
<span class="cline-any cline-yes">1x</span>
|
|
158
|
-
<span class="cline-any cline-neutral"> </span>
|
|
159
|
-
<span class="cline-any cline-yes">12x</span>
|
|
160
|
-
<span class="cline-any cline-yes">12x</span>
|
|
161
|
-
<span class="cline-any cline-yes">12x</span>
|
|
145
|
+
<span class="cline-any cline-yes">2x</span>
|
|
162
146
|
<span class="cline-any cline-yes">12x</span>
|
|
163
147
|
<span class="cline-any cline-neutral"> </span>
|
|
164
|
-
<span class="cline-any cline-neutral"> </span>
|
|
165
|
-
<span class="cline-any cline-yes">12x</span>
|
|
166
148
|
<span class="cline-any cline-yes">12x</span>
|
|
167
149
|
<span class="cline-any cline-yes">12x</span>
|
|
168
150
|
<span class="cline-any cline-yes">12x</span>
|
|
@@ -170,36 +152,20 @@
|
|
|
170
152
|
<span class="cline-any cline-yes">12x</span>
|
|
171
153
|
<span class="cline-any cline-yes">4x</span>
|
|
172
154
|
<span class="cline-any cline-neutral"> </span>
|
|
173
|
-
<span class="cline-any cline-yes">4x</span>
|
|
174
|
-
<span class="cline-any cline-yes">2x</span>
|
|
175
|
-
<span class="cline-any cline-yes">2x</span>
|
|
176
|
-
<span class="cline-any cline-yes">2x</span>
|
|
177
|
-
<span class="cline-any cline-neutral"> </span>
|
|
178
|
-
<span class="cline-any cline-neutral"> </span>
|
|
179
|
-
<span class="cline-any cline-neutral"> </span>
|
|
180
|
-
<span class="cline-any cline-neutral"> </span>
|
|
181
|
-
<span class="cline-any cline-yes">12x</span>
|
|
182
|
-
<span class="cline-any cline-yes">12x</span>
|
|
183
|
-
<span class="cline-any cline-neutral"> </span>
|
|
184
|
-
<span class="cline-any cline-neutral"> </span>
|
|
185
155
|
<span class="cline-any cline-neutral"> </span>
|
|
186
156
|
<span class="cline-any cline-neutral"> </span>
|
|
187
157
|
<span class="cline-any cline-neutral"> </span>
|
|
188
|
-
<span class="cline-any cline-yes">
|
|
158
|
+
<span class="cline-any cline-yes">4x</span>
|
|
189
159
|
<span class="cline-any cline-neutral"> </span>
|
|
190
160
|
<span class="cline-any cline-neutral"> </span>
|
|
191
161
|
<span class="cline-any cline-neutral"> </span>
|
|
192
162
|
<span class="cline-any cline-neutral"> </span>
|
|
193
|
-
<span class="cline-any cline-yes">4x</span>
|
|
194
|
-
<span class="cline-any cline-yes">4x</span>
|
|
195
163
|
<span class="cline-any cline-no"> </span>
|
|
196
164
|
<span class="cline-any cline-no"> </span>
|
|
197
|
-
<span class="cline-any cline-neutral"> </span>
|
|
198
165
|
<span class="cline-any cline-no"> </span>
|
|
199
166
|
<span class="cline-any cline-neutral"> </span>
|
|
200
167
|
<span class="cline-any cline-neutral"> </span>
|
|
201
|
-
<span class="cline-any cline-
|
|
202
|
-
<span class="cline-any cline-yes">4x</span>
|
|
168
|
+
<span class="cline-any cline-no"> </span>
|
|
203
169
|
<span class="cline-any cline-no"> </span>
|
|
204
170
|
<span class="cline-any cline-no"> </span>
|
|
205
171
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -207,120 +173,121 @@
|
|
|
207
173
|
<span class="cline-any cline-neutral"> </span>
|
|
208
174
|
<span class="cline-any cline-neutral"> </span>
|
|
209
175
|
<span class="cline-any cline-yes">12x</span>
|
|
210
|
-
<span class="cline-any cline-yes">
|
|
176
|
+
<span class="cline-any cline-yes">4x</span>
|
|
177
|
+
<span class="cline-any cline-neutral"> </span>
|
|
211
178
|
<span class="cline-any cline-neutral"> </span>
|
|
212
179
|
<span class="cline-any cline-neutral"> </span>
|
|
213
180
|
<span class="cline-any cline-neutral"> </span>
|
|
214
|
-
<span class="cline-any cline-yes">4x</span>
|
|
215
|
-
<span class="cline-any cline-yes">4x</span>
|
|
216
181
|
<span class="cline-any cline-yes">4x</span>
|
|
217
182
|
<span class="cline-any cline-yes">4x</span>
|
|
218
183
|
<span class="cline-any cline-neutral"> </span>
|
|
219
184
|
<span class="cline-any cline-neutral"> </span>
|
|
185
|
+
<span class="cline-any cline-yes">12x</span>
|
|
186
|
+
<span class="cline-any cline-yes">8x</span>
|
|
220
187
|
<span class="cline-any cline-neutral"> </span>
|
|
188
|
+
<span class="cline-any cline-yes">4x</span>
|
|
221
189
|
<span class="cline-any cline-neutral"> </span>
|
|
190
|
+
<span class="cline-any cline-yes">4x</span>
|
|
191
|
+
<span class="cline-any cline-yes">4x</span>
|
|
192
|
+
<span class="cline-any cline-no"> </span>
|
|
193
|
+
<span class="cline-any cline-no"> </span>
|
|
222
194
|
<span class="cline-any cline-neutral"> </span>
|
|
223
195
|
<span class="cline-any cline-neutral"> </span>
|
|
224
196
|
<span class="cline-any cline-neutral"> </span>
|
|
197
|
+
<span class="cline-any cline-yes">4x</span>
|
|
198
|
+
<span class="cline-any cline-neutral"> </span>
|
|
199
|
+
<span class="cline-any cline-neutral"> </span>
|
|
200
|
+
<span class="cline-any cline-yes">12x</span>
|
|
201
|
+
<span class="cline-any cline-yes">4x</span>
|
|
225
202
|
<span class="cline-any cline-neutral"> </span>
|
|
226
203
|
<span class="cline-any cline-neutral"> </span>
|
|
227
204
|
<span class="cline-any cline-neutral"> </span>
|
|
228
205
|
<span class="cline-any cline-neutral"> </span>
|
|
229
206
|
<span class="cline-any cline-yes">4x</span>
|
|
230
|
-
<span class="cline-any cline-yes">4x</span>
|
|
231
207
|
<span class="cline-any cline-neutral"> </span>
|
|
232
208
|
<span class="cline-any cline-neutral"> </span>
|
|
209
|
+
<span class="cline-any cline-no"> </span>
|
|
210
|
+
<span class="cline-any cline-neutral"> </span>
|
|
233
211
|
<span class="cline-any cline-neutral"> </span>
|
|
234
212
|
<span class="cline-any cline-yes">12x</span>
|
|
235
213
|
<span class="cline-any cline-neutral"> </span>
|
|
236
214
|
<span class="cline-any cline-neutral"> </span>
|
|
237
215
|
<span class="cline-any cline-neutral"> </span>
|
|
238
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef,
|
|
239
|
-
|
|
240
|
-
import { v4 as uuidv4 } from "uuid";
|
|
241
|
-
import { MapContext } from "@mapcomponents/react-core";
|
|
216
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef, useCallback, useEffect } from "react";
|
|
242
217
|
|
|
243
|
-
|
|
244
|
-
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
245
|
-
const mapContext = useContext(MapContext);
|
|
246
|
-
const layerInitializedRef = useRef(false);
|
|
247
|
-
const mapRef = useRef(null);
|
|
248
|
-
const componentId = useRef(
|
|
249
|
-
(props.layerId ? <span class="branch-0 cbranch-no" title="branch not covered" >props.layerId </span>: "MlLayer-") + uuidv4()
|
|
250
|
-
);
|
|
251
|
-
const idSuffixRef = useRef(props.idSuffix || new Date().getTime());
|
|
252
|
-
const layerId = (props.layerId || "MlLayer-") + idSuffixRef.current;
|
|
253
|
-
const layerPaintConfRef = useRef(undefined);
|
|
254
|
-
const layerLayoutConfRef = useRef(undefined);
|
|
218
|
+
import useMap from "../../hooks/useMap";
|
|
255
219
|
|
|
256
|
-
|
|
257
|
-
|
|
220
|
+
const MlImageMarkerLayer = (props) => {
|
|
221
|
+
const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
258
222
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
mapRef.current = null;
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}, []);
|
|
223
|
+
const layerInitializedRef = useRef(false);
|
|
224
|
+
const imageIdRef = useRef(props.imageId || "img_" + new Date().getTime());
|
|
225
|
+
const layerId = useRef(props.layerId || "MlImageMarkerLayer-" + mapHook.componentId);
|
|
266
226
|
|
|
267
227
|
useEffect(() => {
|
|
268
228
|
if (
|
|
269
|
-
!
|
|
270
|
-
|
|
271
|
-
!
|
|
272
|
-
!props.options
|
|
229
|
+
!mapHook.mapIsReady ||
|
|
230
|
+
(<span class="branch-1 cbranch-no" title="branch not covered" >mapHook.map </span>&& <span class="branch-2 cbranch-no" title="branch not covered" >!mapHook.map.getLayer(layerId.current))</span> ||
|
|
231
|
+
<span class="branch-3 cbranch-no" title="branch not covered" > !props.options</span>
|
|
273
232
|
)
|
|
274
233
|
return;
|
|
275
234
|
// the MapLibre-gl instance (mapContext.map) is accessible here
|
|
276
235
|
// initialize the layer and add it to the MapLibre-gl instance or do something else with it
|
|
277
236
|
var key;
|
|
278
237
|
|
|
279
|
-
|
|
280
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if (props.options.layout && <span class="branch-1 cbranch-no" title="branch not covered" >layoutString !== layerLayoutConfRef.current)</span> {
|
|
238
|
+
<span class="cstat-no" title="statement not covered" > if (props.options.layout) {</span>
|
|
281
239
|
<span class="cstat-no" title="statement not covered" > for (key in props.options.layout) {</span>
|
|
282
|
-
<span class="cstat-no" title="statement not covered" >
|
|
240
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.setLayoutProperty(layerId.current, key, props.options.layout[key]);</span>
|
|
283
241
|
}
|
|
284
|
-
<span class="cstat-no" title="statement not covered" > layerLayoutConfRef.current = layoutString;</span>
|
|
285
242
|
}
|
|
286
|
-
|
|
287
|
-
let paintString = JSON.stringify(props.options.paint);
|
|
288
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if (props.options.paint && <span class="branch-1 cbranch-no" title="branch not covered" >paintString === layerPaintConfRef.current)</span> {
|
|
243
|
+
<span class="cstat-no" title="statement not covered" > if (props.options.paint) {</span>
|
|
289
244
|
<span class="cstat-no" title="statement not covered" > for (key in props.options.paint) {</span>
|
|
290
|
-
<span class="cstat-no" title="statement not covered" >
|
|
245
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.setPaintProperty(layerId.current, key, props.options.paint[key]);</span>
|
|
291
246
|
}
|
|
292
247
|
}
|
|
293
|
-
}, [props.options, layerId,
|
|
248
|
+
}, [props.options, layerId.current, props.mapId]);
|
|
249
|
+
|
|
250
|
+
const addLayer = useCallback(() => {
|
|
251
|
+
let tmpOptions = {
|
|
252
|
+
id: layerId.current,
|
|
253
|
+
layout: {},
|
|
254
|
+
...props.options,
|
|
255
|
+
};
|
|
256
|
+
tmpOptions.layout["icon-image"] = imageIdRef.current;
|
|
257
|
+
mapHook.map.addLayer(tmpOptions, props.insertBeforeLayer, mapHook.componentId);
|
|
258
|
+
}, [props, mapHook.mapIsReady, mapHook.map]);
|
|
294
259
|
|
|
295
260
|
useEffect(() => {
|
|
296
|
-
if (!
|
|
297
|
-
// the MapLibre-gl instance (mapContext.map) is accessible here
|
|
298
|
-
// initialize the layer and add it to the MapLibre-gl instance or do something else with it
|
|
261
|
+
if (!props.options || !mapHook.mapIsReady || layerInitializedRef.current) return;
|
|
299
262
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
263
|
+
layerInitializedRef.current = true;
|
|
264
|
+
|
|
265
|
+
if (props.imgSrc) {
|
|
266
|
+
mapHook.map.loadImage(props.imgSrc, <span class="fstat-no" title="function not covered" >fu</span>nction (error, image) {
|
|
267
|
+
<span class="cstat-no" title="statement not covered" > if (error) <span class="cstat-no" title="statement not covered" >throw error;</span></span>
|
|
268
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.addImage(imageIdRef.current, image, mapHook.componentId);</span>
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
addLayer();
|
|
273
|
+
}, [mapHook.mapIsReady, mapHook.map, addLayer, props]);
|
|
274
|
+
|
|
275
|
+
useEffect(() => {
|
|
276
|
+
if (
|
|
277
|
+
!mapHook.mapIsReady ||
|
|
278
|
+
(<span class="branch-1 cbranch-no" title="branch not covered" >mapHook.map </span>&& <span class="branch-2 cbranch-no" title="branch not covered" >!mapHook.map.getLayer(layerId.current))</span> ||
|
|
279
|
+
<span class="branch-3 cbranch-no" title="branch not covered" > !props.options</span>
|
|
280
|
+
) {
|
|
281
|
+
return;
|
|
317
282
|
}
|
|
318
|
-
|
|
283
|
+
|
|
284
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.getSource(layerId.current).setData(props.options.source.data);</span>
|
|
285
|
+
}, [props.options.source.data, props]);
|
|
319
286
|
|
|
320
287
|
return <></>;
|
|
321
288
|
};
|
|
322
289
|
|
|
323
|
-
export default
|
|
290
|
+
export default MlImageMarkerLayer;
|
|
324
291
|
</pre></td></tr></table></pre>
|
|
325
292
|
|
|
326
293
|
<div class='push'></div><!-- for sticky footer -->
|
|
@@ -328,17 +295,17 @@ export default MlLayer;
|
|
|
328
295
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
329
296
|
Code coverage generated by
|
|
330
297
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
331
|
-
at
|
|
298
|
+
at Thu Dec 23 2021 12:19:00 GMT+0000 (Coordinated Universal Time)
|
|
332
299
|
</div>
|
|
333
300
|
</div>
|
|
334
|
-
<script src="
|
|
301
|
+
<script src="../../../prettify.js"></script>
|
|
335
302
|
<script>
|
|
336
303
|
window.onload = function () {
|
|
337
304
|
prettyPrint();
|
|
338
305
|
};
|
|
339
306
|
</script>
|
|
340
|
-
<script src="
|
|
341
|
-
<script src="
|
|
307
|
+
<script src="../../../sorter.js"></script>
|
|
308
|
+
<script src="../../../block-navigation.js"></script>
|
|
342
309
|
</body>
|
|
343
310
|
</html>
|
|
344
311
|
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for components/MlImageMarkerLayer</title>
|
|
6
|
+
<title>Code coverage report for src/components/MlImageMarkerLayer</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="
|
|
9
|
-
<link rel="stylesheet" href="
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="
|
|
8
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
11
11
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
12
|
<style type='text/css'>
|
|
13
13
|
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(
|
|
14
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
17
|
</head>
|
|
@@ -19,34 +19,34 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="
|
|
22
|
+
<h1><a href="../../../index.html">All files</a> src/components/MlImageMarkerLayer</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">69.69% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>23/33</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">48.27% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>14/29</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">83.33% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>5/6</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">70.96% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>22/31</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="MlImageMarkerLayer.js"><a href="MlImageMarkerLayer.js.html">MlImageMarkerLayer.js</a></td>
|
|
83
|
-
<td data-value="
|
|
84
|
-
<div class="chart"><div class="cover-fill" style="width:
|
|
83
|
+
<td data-value="69.69" class="pic medium">
|
|
84
|
+
<div class="chart"><div class="cover-fill" style="width: 69%"></div><div class="cover-empty" style="width: 31%"></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="69.69" class="pct medium">69.69%</td>
|
|
87
|
+
<td data-value="33" class="abs medium">23/33</td>
|
|
88
|
+
<td data-value="48.27" class="pct low">48.27%</td>
|
|
89
|
+
<td data-value="29" class="abs low">14/29</td>
|
|
90
|
+
<td data-value="83.33" class="pct high">83.33%</td>
|
|
91
|
+
<td data-value="6" class="abs high">5/6</td>
|
|
92
|
+
<td data-value="70.96" class="pct medium">70.96%</td>
|
|
93
|
+
<td data-value="31" class="abs medium">22/31</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
</tbody>
|
|
@@ -101,17 +101,17 @@
|
|
|
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">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at Thu Dec 23 2021 12:19:00 GMT+0000 (Coordinated Universal Time)
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
107
|
-
<script src="
|
|
107
|
+
<script src="../../../prettify.js"></script>
|
|
108
108
|
<script>
|
|
109
109
|
window.onload = function () {
|
|
110
110
|
prettyPrint();
|
|
111
111
|
};
|
|
112
112
|
</script>
|
|
113
|
-
<script src="
|
|
114
|
-
<script src="
|
|
113
|
+
<script src="../../../sorter.js"></script>
|
|
114
|
+
<script src="../../../block-navigation.js"></script>
|
|
115
115
|
</body>
|
|
116
116
|
</html>
|
|
117
117
|
|