@mapcomponents/react-maplibre 0.1.63 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/.editorconfig +1 -1
  2. package/.eslintrc.js +9 -6
  3. package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
  4. package/CHANGELOG.md +27 -2
  5. package/coverage/clover.xml +671 -1032
  6. package/coverage/coverage-final.json +24 -21
  7. package/coverage/lcov-report/index.html +112 -82
  8. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
  9. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  10. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
  11. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
  12. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
  13. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +2 -5
  18. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  21. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  22. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  23. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +40 -19
  24. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  25. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
  27. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
  28. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +34 -4
  30. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  31. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +394 -0
  33. package/coverage/lcov-report/src/components/{MlGPXViewer → MlGpxViewer}/index.html +23 -38
  34. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
  35. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
  36. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +58 -76
  39. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  40. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
  41. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
  42. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
  44. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  47. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  49. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  51. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
  53. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  56. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  58. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  59. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  60. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  61. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
  62. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
  64. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +1 -1
  65. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +1 -1
  67. package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
  68. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
  69. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
  70. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  71. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  72. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
  73. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  74. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  75. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  76. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +10 -7
  77. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
  78. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  79. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  80. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +111 -57
  81. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
  82. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
  83. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
  84. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
  85. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  86. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  87. package/coverage/lcov-report/src/contexts/index.html +1 -1
  88. package/coverage/lcov-report/src/hooks/index.html +50 -50
  89. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  90. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  92. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
  95. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
  96. package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
  97. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
  99. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
  100. package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
  101. package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
  102. package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
  103. package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
  104. package/coverage/lcov-report/src/index.html +1 -1
  105. package/coverage/lcov-report/src/index.ts.html +6 -6
  106. package/coverage/lcov.info +1284 -1959
  107. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +51 -25
  108. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
  109. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
  110. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
  111. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
  112. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
  113. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
  114. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +1 -1
  115. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +22 -11
  116. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +4 -95
  117. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
  118. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
  119. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
  120. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
  121. package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
  122. package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
  123. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
  124. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
  125. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
  126. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
  127. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
  128. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
  129. package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
  130. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
  131. package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
  132. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
  133. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
  134. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
  135. package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
  136. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
  137. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
  138. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
  139. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
  140. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
  141. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
  142. package/dist/decorators/ThemeWrapper.d.ts +3 -1
  143. package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
  144. package/dist/hooks/useGpx/useGpx.d.ts +26 -0
  145. package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
  146. package/dist/hooks/useLayer.d.ts +13 -7
  147. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
  148. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
  149. package/dist/hooks/useMap.d.ts +1 -1
  150. package/dist/hooks/useMap.test.d.ts +1 -0
  151. package/dist/hooks/useSource.d.ts +2 -2
  152. package/dist/hooks/useWms.d.ts +24 -16
  153. package/dist/index.d.ts +5 -5
  154. package/dist/index.esm.js +9310 -14006
  155. package/dist/index.esm.js.map +1 -1
  156. package/dist/setupTests.d.ts +6 -5
  157. package/dist/ui_components/Dropzone.d.ts +5 -0
  158. package/dist/ui_components/ImageLoader.d.ts +8 -1
  159. package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
  160. package/dist/ui_components/Sidebar.d.ts +7 -6
  161. package/dist/ui_components/Tooltip.d.ts +1 -1
  162. package/dist/ui_components/TopToolbar.d.ts +4 -3
  163. package/dist/ui_components/UploadButton.d.ts +6 -0
  164. package/dist/util/BubbleForInstructions.d.ts +2 -0
  165. package/dist/util/Instructions.d.ts +13 -0
  166. package/package.json +195 -191
  167. package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
  168. package/scripts/build-catalogue-meta.js +35 -11
  169. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
  170. package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
  171. package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
  172. package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
  173. package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
  174. package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
  175. package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
  176. package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
  177. package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
  178. package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
  179. package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
  180. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
  181. package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +1 -2
  182. package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +0 -1
  183. package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
  184. package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
  185. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
  186. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +89 -0
  187. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +24 -17
  188. package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
  189. package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
  190. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
  191. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
  192. package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
  193. package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
  194. package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
  195. package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
  196. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
  197. package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
  198. package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
  199. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
  200. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
  201. package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
  202. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
  203. package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +68 -0
  204. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
  205. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
  206. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
  207. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
  208. package/src/components/MlLayer/MlLayer.meta_.json +1 -2
  209. package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
  210. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
  211. package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
  212. package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
  213. package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
  214. package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
  215. package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
  216. package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
  217. package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
  218. package/src/components/MlMarker/MlMarker.meta_.json +1 -2
  219. package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
  220. package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
  221. package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
  222. package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
  223. package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
  224. package/src/components/MlSketchTool/MlSketchTool.meta.json +1 -2
  225. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
  226. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
  227. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
  228. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
  229. package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
  230. package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
  231. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +1 -2
  232. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
  233. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
  234. package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
  235. package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
  236. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
  237. package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
  238. package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
  239. package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
  240. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
  241. package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
  242. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
  243. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
  244. package/src/decorators/MapContextDecorator.js +1 -1
  245. package/src/decorators/MapContextDecoratorHooks.js +1 -1
  246. package/src/decorators/ThemeWrapper.tsx +9 -0
  247. package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
  248. package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
  249. package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
  250. package/src/hooks/useGpx/useGpx.meta_.json +15 -0
  251. package/src/{components/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
  252. package/src/hooks/useGpx/useGpx.tsx +70 -0
  253. package/src/hooks/useLayer.ts +32 -10
  254. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
  255. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
  256. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
  257. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
  258. package/src/hooks/useMap.test.tsx +48 -0
  259. package/src/hooks/useMap.ts +8 -8
  260. package/src/hooks/useSource.ts +4 -4
  261. package/src/hooks/{useWms.js → useWms.ts} +24 -11
  262. package/src/index.ts +5 -5
  263. package/src/setupTests.js +18 -15
  264. package/src/ui_components/Dropzone.tsx +104 -0
  265. package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
  266. package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
  267. package/src/ui_components/Sidebar.tsx +12 -10
  268. package/src/ui_components/Tooltip.tsx +17 -0
  269. package/src/ui_components/TopToolbar.tsx +5 -3
  270. package/src/ui_components/UploadButton.tsx +57 -0
  271. package/src/util/BubbleForInstructions.js +46 -0
  272. package/src/util/Instructions.tsx +60 -0
  273. package/tsconfig.json +1 -1
  274. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +0 -1222
  275. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
  276. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +0 -757
  277. package/dist/components/MlGPXViewer/util/MlGPXViewerInstructions.d.ts +0 -1
  278. package/dist/components/MlGPXViewer/util/SampleLayer.d.ts +0 -0
  279. package/dist/components/MlGPXViewer/util/demoViewer.d.ts +0 -5
  280. package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -91
  281. package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
  282. package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -379
  283. package/src/components/MlGPXViewer/util/MlGPXViewerInstructions.js +0 -145
  284. package/src/components/MlGPXViewer/util/SampleLayer.js +0 -2
  285. package/src/components/MlGPXViewer/util/demoViewer.js +0 -254
  286. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
  287. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
  288. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
  289. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
  290. package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
  291. package/src/decorators/ThemeWrapper.jsx +0 -9
  292. package/src/ui_components/Legend.js +0 -44
  293. package/src/ui_components/LoadingOverlay.js +0 -41
  294. package/src/ui_components/Tooltip.js +0 -21
@@ -1,19 +1,38 @@
1
- import { layerRemovalTest, sourceRemovalTest } from "../../util";
2
- import { uuid_regex } from "../../setupTests";
1
+ import { layerRemovalTest, sourceRemovalTest } from '../../util';
2
+ import { uuid_regex } from '../../setupTests';
3
3
 
4
- import MlImageMarkerLayer from "./MlImageMarkerLayer";
4
+ import MlImageMarkerLayer from './MlImageMarkerLayer';
5
5
 
6
- const testComponent = <MlImageMarkerLayer options={{ source: {} }} />;
6
+ const testComponent = (
7
+ // eslint-disable-next-line react/react-in-jsx-scope
8
+ <MlImageMarkerLayer
9
+ options={{
10
+ source: {
11
+ type: 'geojson',
12
+ data: {
13
+ type: 'Feature',
14
+ properties: {
15
+ id: 'test',
16
+ },
17
+ geometry: {
18
+ type: 'Point',
19
+ coordinates: [7.0847929969609424, 50.73855193187643],
20
+ },
21
+ },
22
+ },
23
+ }}
24
+ />
25
+ );
7
26
 
8
27
  layerRemovalTest(
9
- "<MlImageMarkerLayer />",
28
+ '<MlImageMarkerLayer />',
10
29
  testComponent,
11
30
  new RegExp('^.*"MlImageMarkerLayer-' + uuid_regex + '".*$'),
12
- "MlImageMarkerLayer-{uuid}"
31
+ 'MlImageMarkerLayer-{uuid}'
13
32
  );
14
33
  sourceRemovalTest(
15
- "<MlImageMarkerLayer />",
34
+ '<MlImageMarkerLayer />',
16
35
  testComponent,
17
36
  new RegExp('^.*"MlImageMarkerLayer-' + uuid_regex + '".*$'),
18
- "MlImageMarkerLayer-{uuid}"
37
+ 'MlImageMarkerLayer-{uuid}'
19
38
  );
@@ -1,9 +1,13 @@
1
- import React, { useRef, useCallback, useEffect } from "react";
1
+ import React, { useRef, useEffect, useState } from 'react';
2
2
 
3
- import { GeoJSONSource } from "maplibre-gl";
4
- import useMap, { useMapType } from "../../hooks/useMap";
3
+ import { v4 as uuidv4 } from 'uuid';
5
4
 
6
- interface MlImageMarkerLayerProps {
5
+ import useLayer from '../../hooks/useLayer';
6
+ import useMap from '../../hooks/useMap';
7
+ import { SymbolLayerSpecification } from 'maplibre-gl';
8
+ import { Feature, FeatureCollection } from '@turf/turf';
9
+
10
+ export interface MlImageMarkerLayerProps {
7
11
  /**
8
12
  * Id of the target MapLibre instance in mapContext
9
13
  */
@@ -28,7 +32,11 @@ interface MlImageMarkerLayerProps {
28
32
  /**
29
33
  * Javascript object that is passed the addLayer command as first parameter.
30
34
  */
31
- options?: any;
35
+ options?: {
36
+ source?: { type?: string | undefined; data: Feature | FeatureCollection | undefined };
37
+ layout?: SymbolLayerSpecification['layout'];
38
+ paint?: SymbolLayerSpecification['paint'];
39
+ };
32
40
  }
33
41
 
34
42
  const MlImageMarkerLayer = (props: MlImageMarkerLayerProps) => {
@@ -37,38 +45,27 @@ const MlImageMarkerLayer = (props: MlImageMarkerLayerProps) => {
37
45
  waitForLayer: props.insertBeforeLayer,
38
46
  });
39
47
 
40
- const initializedRef = useRef(false);
41
- const recreationInProgress = useRef(false);
42
- const imageIdRef = useRef(props.imageId || "img_" + new Date().getTime());
43
- const layerId = useRef(props.layerId || "MlImageMarkerLayer-" + mapHook.componentId);
44
-
45
- // effect to sync Layer paint & layout properties
46
- useEffect(() => {
47
- if (
48
- !mapHook.map ||
49
- (mapHook.map && !mapHook.map.map.getLayer(layerId.current)) ||
50
- !props.options
51
- )
52
- return;
53
-
54
- var key;
55
-
56
- if (props.options.layout) {
57
- for (key in props.options.layout) {
58
- mapHook.map.map.setLayoutProperty(layerId.current, key, props.options.layout[key]);
59
- }
60
- }
61
- if (props.options.paint) {
62
- for (key in props.options.paint) {
63
- mapHook.map.map.setPaintProperty(layerId.current, key, props.options.paint[key]);
64
- }
65
- }
66
- }, [props.options, layerId.current, props.mapId]);
48
+ const [imageId, setImageId] = useState<string>();
49
+ const imageIdRef = useRef(props.imageId || 'img_' + uuidv4());
50
+ const layerId = useRef(props.layerId || 'MlImageMarkerLayer-' + mapHook.componentId);
51
+
52
+ useLayer({
53
+ geojson: props.options?.source?.data,
54
+ layerId: layerId.current,
55
+ options: {
56
+ type: 'symbol',
57
+ layout: {
58
+ ...props.options?.layout,
59
+ 'icon-image': imageId || imageIdRef.current,
60
+ },
61
+ paint: {
62
+ ...props.options?.paint,
63
+ },
64
+ },
65
+ });
67
66
 
68
- const createImage = (mapHook: useMapType, props: MlImageMarkerLayerProps, callback: Function) => {
67
+ const createImage = (mapHook: ReturnType<typeof useMap>, props: MlImageMarkerLayerProps) => {
69
68
  if (!mapHook.map) {
70
- initializedRef.current = false;
71
-
72
69
  return;
73
70
  }
74
71
 
@@ -78,96 +75,25 @@ const MlImageMarkerLayer = (props: MlImageMarkerLayerProps) => {
78
75
 
79
76
  if (!mapHook.map || mapHook.map.map.hasImage(imageIdRef.current)) return;
80
77
 
81
- mapHook.map.addImage(imageIdRef.current, image, mapHook.componentId);
78
+ mapHook.map.addImage(
79
+ imageIdRef.current,
80
+ image as unknown as ImageData,
81
+ mapHook.componentId
82
+ );
82
83
 
83
- if (typeof callback === "function") {
84
- callback();
85
- }
84
+ setImageId(imageIdRef.current);
86
85
  });
87
- } else {
88
- if (typeof callback === "function") {
89
- callback();
90
- }
91
- }
92
- };
93
-
94
- const createLayer = (
95
- mapHook: useMapType,
96
- props: MlImageMarkerLayerProps,
97
- createMapLibreElements: Function
98
- ) => {
99
- if (!props.options || !mapHook.map || mapHook.map?.map.getLayer(layerId.current)) return;
100
-
101
- let tmpOptions = {
102
- id: layerId.current,
103
- layout: {},
104
- ...props.options,
105
- };
106
- tmpOptions.layout["icon-image"] = imageIdRef.current;
107
- mapHook.map.addLayer(tmpOptions, props.insertBeforeLayer, mapHook.componentId);
108
-
109
- // recreate layer if map style.json has changed
110
- mapHook.map.on(
111
- "styledata",
112
- () => {
113
- if (
114
- initializedRef.current &&
115
- !mapHook.map?.map.getLayer(layerId.current) &&
116
- !recreationInProgress.current
117
- ) {
118
- initializedRef.current = false;
119
- recreationInProgress.current = true;
120
- console.log("Recreate Layer " + layerId.current);
121
- createMapLibreElements();
122
- }
123
- },
124
- mapHook.componentId
125
- );
126
-
127
- if (recreationInProgress.current) {
128
- recreationInProgress.current = false;
129
86
  }
130
87
  };
131
88
 
132
- const createMapLibreElements = useCallback(() => {
133
- if (!mapHook.map || initializedRef.current || mapHook.map?.map.getLayer(layerId.current))
134
- return;
135
-
136
- initializedRef.current = true;
137
-
138
- if (recreationInProgress.current) {
139
- mapHook.cleanup();
140
- }
89
+ useEffect(() => {
90
+ if (!mapHook.map) return;
141
91
 
142
92
  if (props.imgSrc) {
143
- createImage(mapHook, props, () => {
144
- createLayer(mapHook, props, createMapLibreElements);
145
- });
146
- } else {
147
- createLayer(mapHook, props, createMapLibreElements);
93
+ createImage(mapHook, props);
148
94
  }
149
95
  }, [props, mapHook]);
150
96
 
151
- useEffect(() => {
152
- if (initializedRef.current) return;
153
-
154
- createMapLibreElements();
155
- }, [createMapLibreElements]);
156
-
157
- useEffect(() => {
158
- if (
159
- !mapHook.map ||
160
- (mapHook.map && !mapHook.map.map.getLayer(layerId.current)) ||
161
- !props.options
162
- ) {
163
- return;
164
- }
165
-
166
- (mapHook.map.map.getSource(layerId.current) as GeoJSONSource).setData(
167
- props.options.source.data
168
- );
169
- }, [props.options.source.data, props]);
170
-
171
97
  return <></>;
172
98
  };
173
99
 
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": ["Map add-on"],
12
12
  "category": "add-ons",
13
- "type": "component",
14
- "price": 5000
13
+ "type": "component"
15
14
  }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+
3
+ import MlLayerMagnify from './MlLayerMagnify';
4
+ import MlWmsLayer from '../MlWmsLayer/MlWmsLayer';
5
+
6
+ import multiMapContextDecorator from '../../decorators/MultiMapContextDecorator';
7
+
8
+ const storyoptions = {
9
+ title: 'MapComponents/MlLayerMagnify',
10
+ component: MlLayerMagnify,
11
+ argTypes: {},
12
+ decorators: multiMapContextDecorator,
13
+ };
14
+ export default storyoptions;
15
+
16
+ interface TemplateProps {
17
+ wmsLayerMapId: string;
18
+ magnifierRadius: number;
19
+ }
20
+
21
+ const Template = (args: TemplateProps) => (
22
+ <>
23
+ <MlWmsLayer
24
+ url="https://www.wms.nrw.de/geobasis/wms_nw_uraufnahme"
25
+ urlParameters={{
26
+ layers: 'nw_uraufnahme_rw',
27
+ }}
28
+ sourceOptions={{
29
+ minzoom: 13,
30
+ maxzoom: 20,
31
+ }}
32
+ mapId={args.wmsLayerMapId}
33
+
34
+ />
35
+ <MlLayerMagnify map1Id="map_1" map2Id="map_2" magnifierStyle={{border:'2px solid grey'}} magnifierRadius={args.magnifierRadius} />
36
+ </>
37
+ );
38
+
39
+ export const ExampleConfig = Template.bind({});
40
+ ExampleConfig.parameters = {};
41
+ ExampleConfig.args = {
42
+ wmsLayerMapId: 'map_2',
43
+ magnifierRadius: 200,
44
+ };
@@ -1,17 +1,18 @@
1
- import MlLayerMagnify from "./MlLayerMagnify";
1
+ import MlLayerMagnify from './MlLayerMagnify';
2
2
 
3
- import React, { useContext, useState } from "react";
4
- import { mount } from "enzyme";
5
- import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
6
- import MapLibreMap from "./../MapLibreMap/MapLibreMap";
7
- import syncMove from "@mapbox/mapbox-gl-sync-move";
3
+ import React, { useContext, useState } from 'react';
4
+ import { mount } from 'enzyme';
5
+ import MapContext, { MapComponentsProvider } from '../../contexts/MapContext';
6
+ import MapLibreMap from './../MapLibreMap/MapLibreMap';
7
+ // we need to import this explicitly, because otherwise it gets mixed up with cypress expect
8
+ import { expect } from '@jest/globals';
8
9
  // Mapbox sync-move mockup
9
- var mockSyncMoveMethods = {
10
+ const mockSyncMoveMethods = {
10
11
  cleanup: jest.fn(),
11
12
  };
12
13
 
13
- jest.mock("@mapbox/mapbox-gl-sync-move", () => {
14
- const originalModule = jest.requireActual("@mapbox/mapbox-gl-sync-move");
14
+ jest.mock('@mapbox/mapbox-gl-sync-move', () => {
15
+ const originalModule = jest.requireActual('@mapbox/mapbox-gl-sync-move');
15
16
  return {
16
17
  __esModule: true,
17
18
  ...originalModule,
@@ -19,11 +20,7 @@ jest.mock("@mapbox/mapbox-gl-sync-move", () => {
19
20
  };
20
21
  });
21
22
 
22
- const syncMoveObj = {
23
- syncMove: syncMove,
24
- };
25
-
26
- const TestComponent = (props) => {
23
+ const TestComponent = () => {
27
24
  const [layerVisible, setLayerVisible] = useState(true);
28
25
  const [refreshTrigger, setRefreshTrigger] = useState(0);
29
26
  const mapContext = useContext(MapContext);
@@ -65,7 +62,7 @@ const createWrapper = () =>
65
62
  </MapComponentsProvider>
66
63
  );
67
64
 
68
- describe("<MlLayerMagnify/>", () => {
65
+ describe('<MlLayerMagnify/>', () => {
69
66
  //it("should add a MlLayerMagnify Component to that calls syncMaps with both available MapLibre instances once", async () => {
70
67
  // const spy = jest.spyOn(syncMoveObj, "syncMove");
71
68
  // const wrapper = createWrapper(TestComponent);
@@ -73,12 +70,12 @@ describe("<MlLayerMagnify/>", () => {
73
70
  // expect(spy).toHaveBeenCalledTimes(1);
74
71
  //});
75
72
 
76
- it("should call the syncMaps cleanup function once when it is removed from reactDOM", async () => {
77
- const wrapper = createWrapper(TestComponent);
73
+ it('should call the syncMaps cleanup function once when it is removed from reactDOM', async () => {
74
+ const wrapper = createWrapper();
78
75
 
79
76
  //expect(syncMove).toHaveBeenCalledTimes(1);
80
77
 
81
- wrapper.find(".toggle_layer_visible").simulate("click");
78
+ wrapper.find('.toggle_layer_visible').simulate('click');
82
79
 
83
80
  //TODO: Fix cleanup test
84
81
  expect(mockSyncMoveMethods.cleanup).toHaveBeenCalledTimes(1);
@@ -1,17 +1,11 @@
1
- import React, {
2
- useContext,
3
- useCallback,
4
- useRef,
5
- useEffect,
6
- useState,
7
- useMemo
8
- } from "react";
1
+ import React, { useContext, useCallback, useRef, useEffect, useState, useMemo } from 'react';
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9
3
  // @ts-ignore
10
- import syncMove from "@mapbox/mapbox-gl-sync-move";
11
- import "./style.css";
12
- import MapContext from "../../contexts/MapContext";
4
+ import syncMove from '@mapbox/mapbox-gl-sync-move';
5
+ import './style.css';
6
+ import MapContext from '../../contexts/MapContext';
13
7
 
14
- interface MlLayerMagnifyProps {
8
+ export interface MlLayerMagnifyProps {
15
9
  /**
16
10
  * Id of the first MapLibre instance
17
11
  */
@@ -24,6 +18,10 @@ interface MlLayerMagnifyProps {
24
18
  * Size of the "magnifier"-circle
25
19
  */
26
20
  magnifierRadius?: number;
21
+ /**
22
+ * object (React.CSSProperties) that is added to the magnifier default style
23
+ */
24
+ magnifierStyle: React.CSSProperties | undefined;
27
25
  }
28
26
 
29
27
  /**
@@ -32,7 +30,7 @@ interface MlLayerMagnifyProps {
32
30
  * the map and can be dragged around on top of the MapLibreMap referenced by props.map1Id
33
31
  */
34
32
  const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
35
- const mapContext:MapContextType = useContext(MapContext);
33
+ const mapContext: MapContextType = useContext(MapContext);
36
34
  const syncMoveInitializedRef = useRef(false);
37
35
  const syncCleanupFunctionRef = useRef(() => {});
38
36
 
@@ -43,7 +41,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
43
41
 
44
42
  const magnifierRadius = useMemo(() => {
45
43
  return props.magnifierRadius || 200;
46
- },[props.magnifierRadius]);
44
+ }, [props.magnifierRadius]);
47
45
 
48
46
  const mapExists = useCallback(() => {
49
47
  if (!props.map1Id || !props.map2Id) {
@@ -66,11 +64,11 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
66
64
  });
67
65
 
68
66
  useEffect(() => {
69
- window.addEventListener("resize", onResize.current);
70
- let _onResize = onResize.current;
67
+ window.addEventListener('resize', onResize.current);
68
+ const _onResize = onResize.current;
71
69
 
72
70
  return () => {
73
- window.removeEventListener("resize", _onResize);
71
+ window.removeEventListener('resize', _onResize);
74
72
  syncCleanupFunctionRef.current();
75
73
  };
76
74
  }, []);
@@ -79,29 +77,24 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
79
77
  (e) => {
80
78
  if (!mapExists()) return;
81
79
 
82
- let bounds = mapContext.maps[props.map1Id]
83
- .getCanvas()
84
- .getBoundingClientRect();
80
+ const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
85
81
  let clientX =
86
82
  e.clientX ||
87
- (typeof e.touches !== "undefined" && typeof e.touches[0] !== "undefined"
83
+ (typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
88
84
  ? e.touches[0].clientX
89
85
  : 0);
90
86
  let clientY =
91
87
  e.clientY ||
92
- (typeof e.touches !== "undefined" && typeof e.touches[0] !== "undefined"
88
+ (typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
93
89
  ? e.touches[0].clientY
94
90
  : 0);
95
91
 
96
92
  clientX -= bounds.x;
97
93
  clientY -= bounds.y;
98
- let swipeX_tmp = ((clientX / bounds.width) * 100).toFixed(2);
99
- let swipeY_tmp = ((clientY / bounds.height) * 100).toFixed(2);
94
+ const swipeX_tmp = ((clientX / bounds.width) * 100).toFixed(2);
95
+ const swipeY_tmp = ((clientY / bounds.height) * 100).toFixed(2);
100
96
 
101
- if (
102
- swipeXRef.current !== swipeX_tmp ||
103
- swipeYRef.current !== swipeY_tmp
104
- ) {
97
+ if (swipeXRef.current !== swipeX_tmp || swipeYRef.current !== swipeY_tmp) {
105
98
  setSwipeX(swipeX_tmp);
106
99
  swipeXRef.current = swipeX_tmp;
107
100
  setSwipeY(swipeY_tmp);
@@ -110,9 +103,9 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
110
103
  mapContext.maps[props.map2Id].getContainer().style.clipPath =
111
104
  `circle(${magnifierRadius}px at ` +
112
105
  (parseFloat(swipeXRef.current) * bounds.width) / 100 +
113
- "px " +
106
+ 'px ' +
114
107
  (parseFloat(swipeYRef.current) * bounds.height) / 100 +
115
- "px)";
108
+ 'px)';
116
109
  }
117
110
  },
118
111
  [mapContext, mapExists, props, magnifierRadius]
@@ -160,53 +153,53 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
160
153
  });
161
154
  }, [mapContext.mapIds, mapContext, mapExists, props, onMove]);
162
155
 
163
- const onDown = (e:any) => {
164
- if (e.touches) {
165
- document.addEventListener("touchmove", onMove);
166
- document.addEventListener("touchend", onTouchEnd);
156
+ const onDown = (e: React.MouseEvent | React.TouchEvent) => {
157
+ if (e.nativeEvent instanceof TouchEvent) {
158
+ document.addEventListener('touchmove', onMove);
159
+ document.addEventListener('touchend', onTouchEnd);
167
160
  } else {
168
- document.addEventListener("mousemove", onMove);
169
- document.addEventListener("mouseup", onMouseUp);
161
+ document.addEventListener('mousemove', onMove);
162
+ document.addEventListener('mouseup', onMouseUp);
170
163
  }
171
164
  };
172
165
 
173
166
  const onTouchEnd = () => {
174
- document.removeEventListener("touchmove", onMove);
175
- document.removeEventListener("touchend", onTouchEnd);
167
+ document.removeEventListener('touchmove', onMove);
168
+ document.removeEventListener('touchend', onTouchEnd);
176
169
  };
177
170
 
178
171
  const onMouseUp = () => {
179
- document.removeEventListener("mousemove", onMove);
180
- document.removeEventListener("mouseup", onMouseUp);
172
+ document.removeEventListener('mousemove', onMove);
173
+ document.removeEventListener('mouseup', onMouseUp);
181
174
  };
182
175
 
183
- const onWheel = (e:any) => {
184
- let evCopy = new WheelEvent(e.type, e);
176
+ const onWheel = (e: React.WheelEvent) => {
177
+ const evCopy = new WheelEvent(e.type, e as unknown as WheelEventInit);
185
178
  mapContext.map.getCanvas().dispatchEvent(evCopy);
186
179
  };
187
180
 
188
181
  return (
189
182
  <div
190
183
  style={{
191
- position: "absolute",
192
- left: swipeX + "%",
193
- top: swipeY + "%",
194
- borderRadius: "50%",
195
- width: magnifierRadius * 2 + 1 + "px",
196
- height: magnifierRadius * 2 + 1 + "px",
197
- background: "rgba(0,0,0,0)",
198
- border: "2px solid #fafafa",
199
- boxShadow:
200
- "1px 2px 2px rgba(19, 19, 19, .5), inset 1px 1px 1px rgba(19, 19, 19, .2)",
201
- cursor: "pointer",
202
- zIndex: "110",
203
- marginLeft: magnifierRadius * -1 - 1 + "px",
204
- marginTop: magnifierRadius * -1 - 1 + "px",
205
- textAlign: "center",
206
- lineHeight: "91px",
207
- fontSize: "2em",
208
- color: "#fafafa",
209
- userSelect: "none",
184
+ position: 'absolute',
185
+ left: swipeX + '%',
186
+ top: swipeY + '%',
187
+ borderRadius: '50%',
188
+ width: magnifierRadius * 2 - 2 + 'px',
189
+ height: magnifierRadius * 2 - 2 + 'px',
190
+ background: 'rgba(0,0,0,0)',
191
+ border: '2px solid #fafafa',
192
+ boxShadow: '1px 2px 2px rgba(19, 19, 19, .5), inset 1px 1px 1px rgba(19, 19, 19, .2)',
193
+ cursor: 'pointer',
194
+ zIndex: '110',
195
+ marginLeft: magnifierRadius * -1 - 1 + 'px',
196
+ marginTop: magnifierRadius * -1 - 1 + 'px',
197
+ textAlign: 'center',
198
+ lineHeight: '91px',
199
+ fontSize: '2em',
200
+ color: '#fafafa',
201
+ userSelect: 'none',
202
+ ...props.magnifierStyle,
210
203
  }}
211
204
  onTouchStart={onDown}
212
205
  onMouseDown={onDown}
@@ -217,6 +210,7 @@ const MlLayerMagnify = (props: MlLayerMagnifyProps) => {
217
210
 
218
211
  MlLayerMagnify.defaultProps = {
219
212
  magnifierRadius: 200,
213
+ magnifierStyle: {},
220
214
  };
221
215
 
222
216
  export default MlLayerMagnify;
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": ["Map add-on"],
12
12
  "category": "add-ons",
13
- "type": "component",
14
- "price": 5000
13
+ "type": "component"
15
14
  }
@@ -1,26 +1,24 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
 
3
- import MlLayerSwipe from "./MlLayerSwipe";
4
- import MlWmsLayer from "../MlWmsLayer/MlWmsLayer";
3
+ import MlLayerSwipe from './MlLayerSwipe';
4
+ import MlWmsLayer from '../MlWmsLayer/MlWmsLayer';
5
5
 
6
- import multiMapContextDecorator from "../../decorators/MultiMapContextDecorator";
6
+ import multiMapContextDecorator from '../../decorators/MultiMapContextDecorator';
7
7
 
8
8
  const storyoptions = {
9
- title: "MapComponents/MlLayerSwipe",
10
- name: "MlLayerSwipe",
9
+ title: 'MapComponents/MlLayerSwipe',
11
10
  component: MlLayerSwipe,
12
- argTypes: {
13
- },
11
+ argTypes: {},
14
12
  decorators: multiMapContextDecorator,
15
13
  };
16
- export default storyoptions;
17
14
 
18
- const Template = (args) => (
15
+ export default storyoptions;
16
+ const Template = () => (
19
17
  <>
20
18
  <MlWmsLayer
21
19
  url="https://www.wms.nrw.de/geobasis/wms_nw_uraufnahme"
22
20
  urlParameters={{
23
- layers: "nw_uraufnahme_rw",
21
+ layers: 'nw_uraufnahme_rw',
24
22
  }}
25
23
  sourceOptions={{
26
24
  minzoom: 13,