@mapcomponents/react-maplibre 0.1.49 → 0.1.53

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 (101) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/coverage/clover.xml +133 -112
  3. package/coverage/coverage-final.json +5 -4
  4. package/coverage/lcov-report/index.html +32 -17
  5. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +1 -1
  6. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  7. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +343 -0
  8. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +116 -0
  9. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
  10. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  11. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
  12. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  13. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  14. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  15. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +1 -1
  18. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
  19. package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
  20. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +26 -11
  21. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  22. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
  23. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
  24. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  25. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  26. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
  27. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  28. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
  29. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
  30. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  31. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
  32. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  33. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  34. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  35. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  36. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  39. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  40. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +195 -42
  41. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +15 -15
  42. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  44. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  46. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  47. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  48. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  49. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
  50. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
  51. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  52. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  53. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +22 -19
  54. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  55. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  56. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
  58. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
  59. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  60. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  61. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
  62. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
  63. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
  64. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
  65. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +1 -1
  66. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  67. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  68. package/coverage/lcov-report/src/contexts/index.html +1 -1
  69. package/coverage/lcov-report/src/hooks/index.html +1 -1
  70. package/coverage/lcov-report/src/hooks/useLayer.ts.html +19 -10
  71. package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
  72. package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
  73. package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
  74. package/coverage/lcov-report/src/index.html +1 -1
  75. package/coverage/lcov-report/src/index.ts.html +1 -1
  76. package/coverage/lcov.info +301 -257
  77. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +3 -2
  78. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +50 -0
  79. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +17 -0
  80. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +15 -8
  81. package/dist/components/MlNavigationTools/MlNavigationTools.d.ts +39 -3
  82. package/dist/components/MlNavigationTools/MlNavigationTools.stories.d.ts +8 -3
  83. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +22 -17
  84. package/dist/decorators/NoNavToolsDecorator.d.ts +2 -0
  85. package/dist/hooks/useLayer.d.ts +7 -5
  86. package/dist/index.esm.js +78 -15
  87. package/dist/index.esm.js.map +1 -1
  88. package/package.json +1 -1
  89. package/scripts/create-map-component.sh +2 -2
  90. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +4 -3
  91. package/src/components/MlCenterPosition/MlCenterPosition.doc.de.md +3 -0
  92. package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +15 -0
  93. package/src/components/MlCenterPosition/MlCenterPosition.stories.js +21 -0
  94. package/src/components/MlCenterPosition/MlCenterPosition.tsx +86 -0
  95. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +14 -9
  96. package/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.ts +2 -1
  97. package/src/components/MlNavigationTools/MlNavigationTools.stories.js +43 -6
  98. package/src/components/MlNavigationTools/MlNavigationTools.tsx +79 -28
  99. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +18 -17
  100. package/src/decorators/NoNavToolsDecorator.js +31 -0
  101. package/src/hooks/useLayer.ts +11 -8
@@ -0,0 +1,50 @@
1
+ interface MlCenterPositionProps {
2
+ /**
3
+ * Id of the target MapLibre instance in mapContext
4
+ */
5
+ mapId?: string;
6
+ /**
7
+ * Id of an existing layer in the mapLibre instance to help specify the layer order
8
+ * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
9
+ */
10
+ insertBeforeLayer?: string;
11
+ /**
12
+ * Active button font color
13
+ */
14
+ onColor?: string;
15
+ /**
16
+ * Inactive button font color
17
+ */
18
+ offColor?: string;
19
+ /**
20
+ * CSS style object that is applied to the button component
21
+ */
22
+ style?: any;
23
+ }
24
+ /**
25
+ * Component template
26
+ *
27
+ */
28
+ declare const MlCenterPosition: {
29
+ (props: MlCenterPositionProps): JSX.Element;
30
+ defaultProps: {
31
+ mapId: undefined;
32
+ style: {
33
+ minWidth: string;
34
+ minHeight: string;
35
+ width: string;
36
+ height: string;
37
+ backgroundColor: string;
38
+ borderRadius: string;
39
+ margin: number;
40
+ fontSize: string;
41
+ ":hover": {
42
+ backgroundColor: string;
43
+ color: string;
44
+ };
45
+ };
46
+ onColor: string;
47
+ offColor: string;
48
+ };
49
+ };
50
+ export default MlCenterPosition;
@@ -0,0 +1,17 @@
1
+ export default storyoptions;
2
+ export const ExampleConfig: any;
3
+ declare namespace storyoptions {
4
+ export const title: string;
5
+ export { MlCenterPosition as component };
6
+ export const argTypes: {};
7
+ export { mapContextDecorator as decorators };
8
+ export namespace parameters {
9
+ namespace docs {
10
+ namespace source {
11
+ const type: string;
12
+ }
13
+ }
14
+ }
15
+ }
16
+ import MlCenterPosition from "./MlCenterPosition";
17
+ import mapContextDecorator from "../../decorators/MapContextDecorator";
@@ -1,4 +1,5 @@
1
1
  import { Feature, FeatureCollection } from "@turf/turf";
2
+ import { LineLayerSpecification, CircleLayerSpecification, FillLayerSpecification, MapLayerMouseEvent } from "maplibre-gl";
2
3
  declare type MlGeoJsonLayerProps = {
3
4
  /**
4
5
  * Id of the target MapLibre instance in mapContext
@@ -7,6 +8,8 @@ declare type MlGeoJsonLayerProps = {
7
8
  /**
8
9
  * Id of an existing layer in the mapLibre instance to help specify the layer order
9
10
  * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
11
+ * This layer will not be added to the maplibre-gl instance until a layer with an
12
+ * id that matches the value of insertBeforeLayer is created.
10
13
  */
11
14
  insertBeforeLayer?: string;
12
15
  /**
@@ -21,7 +24,7 @@ declare type MlGeoJsonLayerProps = {
21
24
  * Type of the layer that will be added to the MapLibre instance.
22
25
  * Possible values: "line", "circle", "fill"
23
26
  */
24
- type?: string;
27
+ type?: "fill" | "line" | "circle";
25
28
  /**
26
29
  * Paint property object, that is passed to the addLayer call.
27
30
  * Possible props depend on the layer type.
@@ -29,7 +32,7 @@ declare type MlGeoJsonLayerProps = {
29
32
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
30
33
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
31
34
  */
32
- paint?: any;
35
+ paint?: CircleLayerSpecification['paint'] | FillLayerSpecification['paint'] | LineLayerSpecification['paint'];
33
36
  /**
34
37
  * Layout property object, that is passed to the addLayer call.
35
38
  * Possible props depend on the layer type.
@@ -37,28 +40,32 @@ declare type MlGeoJsonLayerProps = {
37
40
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
38
41
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
39
42
  */
40
- layout?: any;
43
+ layout?: CircleLayerSpecification['layout'] | FillLayerSpecification['layout'] | LineLayerSpecification['layout'];
41
44
  /**
42
45
  * Javascript object that is spread into the addLayer commands first parameter.
43
46
  */
44
- options?: any;
47
+ options?: CircleLayerSpecification | FillLayerSpecification | LineLayerSpecification;
45
48
  /**
46
49
  * Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
47
50
  */
48
- defaultPaintOverrides?: any;
51
+ defaultPaintOverrides?: {
52
+ circle?: CircleLayerSpecification['paint'];
53
+ fill?: FillLayerSpecification['paint'];
54
+ line?: LineLayerSpecification['paint'];
55
+ };
49
56
  /**
50
57
  * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
51
58
  */
52
- onHover?: Function;
59
+ onHover?: MapLayerMouseEvent;
53
60
  /**
54
61
  * Click event handler that is executed whenever a geometry rendered by this component is clicked.
55
62
  */
56
- onClick?: Function;
63
+ onClick?: MapLayerMouseEvent;
57
64
  /**
58
65
  * Leave event handler that is executed whenever a geometry rendered by this component is
59
66
  * left/unhovered.
60
67
  */
61
- onLeave?: Function;
68
+ onLeave?: MapLayerMouseEvent;
62
69
  };
63
70
  /**
64
71
  * Adds source and layer of types "line", "fill" or "circle" to display GeoJSON data on the map.
@@ -1,9 +1,45 @@
1
1
  interface MlNavigationToolsProps {
2
+ /**
3
+ * Id of the target MapLibre instance in mapContext
4
+ */
2
5
  mapId?: string;
6
+ /**
7
+ * The layerId of an existing layer this layer should be rendered visually beneath
8
+ * https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
9
+ */
3
10
  insertBeforeLayer?: string;
11
+ /**
12
+ * Show 3D button
13
+ */
14
+ show3DButton?: boolean;
15
+ /**
16
+ * Show zoom button
17
+ */
18
+ showZoomButtons?: boolean;
19
+ /**
20
+ * Show follow GPS button
21
+ */
22
+ showFollowGpsButton?: boolean;
23
+ /**
24
+ * Show center on current position button
25
+ */
26
+ showCenterLocationButton?: boolean;
27
+ /**
28
+ * Additional JSX Elements to be rendered below MlNavigationTools buttons
29
+ */
30
+ children?: JSX.Element;
4
31
  }
5
32
  /**
6
- * @component
7
- */
8
- declare const MlNavigationTools: (props: MlNavigationToolsProps) => JSX.Element;
33
+ * @component
34
+ */
35
+ declare const MlNavigationTools: {
36
+ (props: MlNavigationToolsProps): JSX.Element;
37
+ defaultProps: {
38
+ mapId: undefined;
39
+ show3DButton: boolean;
40
+ showFollowGpsButton: boolean;
41
+ showCenterLocationButton: boolean;
42
+ showZoomButtons: boolean;
43
+ };
44
+ };
9
45
  export default MlNavigationTools;
@@ -1,5 +1,10 @@
1
1
  export default storyoptions;
2
- export const ExampleConfig: any;
2
+ export const DefaultConfig: any;
3
+ export const No3DButton: any;
4
+ export const ShowCenterLocationButton: any;
5
+ export const NoZoomButtons: any;
6
+ export const NoFollowGpsButton: any;
7
+ export const CustomButton: any;
3
8
  declare namespace storyoptions {
4
9
  export const title: string;
5
10
  export { MlNavigationTools as component };
@@ -7,7 +12,7 @@ declare namespace storyoptions {
7
12
  const url: {};
8
13
  const layer: {};
9
14
  }
10
- export { mapContextDecorator as decorators };
15
+ export { noNavToolsDecorator as decorators };
11
16
  }
12
17
  import MlNavigationTools from "./MlNavigationTools";
13
- import mapContextDecorator from "../../decorators/MapContextDecorator";
18
+ import noNavToolsDecorator from "../../decorators/NoNavToolsDecorator";
@@ -1,60 +1,65 @@
1
1
  import { Feature, FeatureCollection } from "@turf/turf";
2
+ import { CircleLayerSpecification, FillLayerSpecification, LineLayerSpecification, MapLayerMouseEvent } from "maplibre-gl";
2
3
  interface MlTransitionGeoJsonLayerProps {
3
4
  /**
4
5
  * Id of the target MapLibre instance in mapContext
5
6
  */
6
7
  mapId: string;
8
+ /**
9
+ * GeoJSON data that is supposed to be rendered by this component.
10
+ */
11
+ geojson: Feature | FeatureCollection | undefined;
7
12
  /**
8
13
  * Type of the layer that will be added to the MapLibre instance.
9
14
  * Possible values: "line", "circle", "fill"
10
15
  */
11
- type: string;
16
+ type?: "fill" | "line" | "circle";
12
17
  /**
13
- * Layout property object, that is passed to the addLayer call.
18
+ * Paint property object, that is passed to the addLayer call.
14
19
  * Possible props depend on the layer type.
15
20
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
16
21
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
17
22
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
18
23
  */
19
- layout: any;
24
+ paint?: CircleLayerSpecification['paint'] | FillLayerSpecification['paint'] | LineLayerSpecification['paint'];
20
25
  /**
21
- * Paint property object, that is passed to the addLayer call.
26
+ * Layout property object, that is passed to the addLayer call.
22
27
  * Possible props depend on the layer type.
23
28
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
24
29
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
25
30
  * https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
26
31
  */
27
- paint: any;
28
- /**
29
- * Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
30
- */
31
- defaultPaintOverrides: any;
32
+ layout?: CircleLayerSpecification['layout'] | FillLayerSpecification['layout'] | LineLayerSpecification['layout'];
32
33
  /**
33
34
  * Javascript object that is spread into the addLayer commands first parameter.
34
35
  */
35
- options: any;
36
+ options?: CircleLayerSpecification | FillLayerSpecification | LineLayerSpecification;
36
37
  /**
37
- * GeoJSON data that is supposed to be rendered by this component.
38
+ * Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
38
39
  */
39
- geojson: Feature | FeatureCollection;
40
+ defaultPaintOverrides?: {
41
+ circle?: CircleLayerSpecification['paint'];
42
+ fill?: FillLayerSpecification['paint'];
43
+ line?: LineLayerSpecification['paint'];
44
+ };
40
45
  /**
41
46
  * Id of an existing layer in the mapLibre instance to help specify the layer order
42
47
  * This layer will be visually beneath the layer with the "insertBeforeLayer" id.
43
48
  */
44
49
  insertBeforeLayer: string;
45
50
  /**
46
- * Click event handler that is executed whenever a geometry rendered by this component is clicked.
51
+ * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
47
52
  */
48
- onClick: Function;
53
+ onHover?: MapLayerMouseEvent;
49
54
  /**
50
- * Hover event handler that is executed whenever a geometry rendered by this component is hovered.
55
+ * Click event handler that is executed whenever a geometry rendered by this component is clicked.
51
56
  */
52
- onHover: Function;
57
+ onClick?: MapLayerMouseEvent;
53
58
  /**
54
59
  * Leave event handler that is executed whenever a geometry rendered by this component is
55
60
  * left/unhovered.
56
61
  */
57
- onLeave: Function;
62
+ onLeave?: MapLayerMouseEvent;
58
63
  /**
59
64
  * Creates transition animation whenever the geojson prop changes.
60
65
  * Only works with layer type "line" and LineString GeoJSON data.
@@ -0,0 +1,2 @@
1
+ export default decorators;
2
+ declare const decorators: ((Story: any) => JSX.Element)[];
@@ -1,6 +1,8 @@
1
1
  import { useMapType } from "./useMap";
2
2
  import { LayerSpecification } from "maplibre-gl";
3
3
  import MapLibreGlWrapper from "../components/MapLibreMap/lib/MapLibreGlWrapper";
4
+ import { MapLayerMouseEvent } from "maplibre-gl";
5
+ import { GeoJSONObject } from "@turf/turf";
4
6
  declare type useLayerType = {
5
7
  map: MapLibreGlWrapper | undefined;
6
8
  layer: LayerSpecification;
@@ -14,11 +16,11 @@ interface useLayerProps {
14
16
  idPrefix?: string;
15
17
  insertBeforeLayer?: string;
16
18
  insertBeforeFirstSymbolLayer?: boolean;
17
- geojson?: object;
18
- options: LayerSpecification;
19
- onHover?: Function;
20
- onClick?: Function;
21
- onLeave?: Function;
19
+ geojson?: GeoJSONObject;
20
+ options: Partial<LayerSpecification>;
21
+ onHover?: MapLayerMouseEvent;
22
+ onClick?: MapLayerMouseEvent;
23
+ onLeave?: MapLayerMouseEvent;
22
24
  }
23
25
  declare function useLayer(props: useLayerProps): useLayerType;
24
26
  export default useLayer;
package/dist/index.esm.js CHANGED
@@ -13316,8 +13316,55 @@ function useMediaQuery(queryInput, options = {}) {
13316
13316
  }
13317
13317
 
13318
13318
  /**
13319
- * @component
13320
- */
13319
+ * Component template
13320
+ *
13321
+ */
13322
+ var MlCenterPosition = function (props) {
13323
+ var _a, _b;
13324
+ var mapHook = useMap({
13325
+ mapId: props.mapId,
13326
+ waitForLayer: props.insertBeforeLayer,
13327
+ });
13328
+ var _c = useState(false), locationAccessDenied = _c[0], setLocationAccessDenied = _c[1];
13329
+ var centerCurrentLocation = function () {
13330
+ navigator.geolocation.getCurrentPosition(getLocationSuccess, getLocationError);
13331
+ };
13332
+ var getLocationSuccess = useCallback(function (location) {
13333
+ var _a, _b, _c;
13334
+ (_c = (_a = mapHook.map) === null || _a === void 0 ? void 0 : (_b = _a.map).setCenter) === null || _c === void 0 ? void 0 : _c.call(_b, [location.coords.longitude, location.coords.latitude]);
13335
+ }, [mapHook.map]);
13336
+ var getLocationError = function () {
13337
+ console.log("Access of user location denied");
13338
+ setLocationAccessDenied(true);
13339
+ };
13340
+ return React__default.createElement(React__default.Fragment, null,
13341
+ React__default.createElement(Button$2, { sx: __assign({ zIndex: 1002, color: !locationAccessDenied ? props.onColor : props.offColor }, props.style), onClick: centerCurrentLocation, disabled: locationAccessDenied },
13342
+ React__default.createElement(default_1$4, { sx: __assign({}, (((_a = props.style) === null || _a === void 0 ? void 0 : _a.fontSize) ? { fontSize: (_b = props.style) === null || _b === void 0 ? void 0 : _b.fontSize } : {})) }),
13343
+ " "));
13344
+ };
13345
+ MlCenterPosition.defaultProps = {
13346
+ mapId: undefined,
13347
+ style: {
13348
+ minWidth: "30px",
13349
+ minHeight: "30px",
13350
+ width: "30px",
13351
+ height: "30px",
13352
+ backgroundColor: "#414141",
13353
+ borderRadius: "23%",
13354
+ margin: 0.15,
13355
+ fontSize: "1.3em",
13356
+ ":hover": {
13357
+ backgroundColor: "#515151",
13358
+ color: "#ececec",
13359
+ },
13360
+ },
13361
+ onColor: "#ececec",
13362
+ offColor: "#666",
13363
+ };
13364
+
13365
+ /**
13366
+ * @component
13367
+ */
13321
13368
  var MlNavigationTools = function (props) {
13322
13369
  var mapHook = useMap({
13323
13370
  mapId: props.mapId,
@@ -13335,12 +13382,15 @@ var MlNavigationTools = function (props) {
13335
13382
  //border: "1px solid #bbb",
13336
13383
  //boxShadow: "0px 0px 4px rgba(0,0,0,.5)",
13337
13384
  margin: 0.15,
13338
- fontSize: mediaIsMobile ? "1.5em" : "1.2em",
13385
+ fontSize: mediaIsMobile ? "1.4em" : "1.2em",
13339
13386
  ":hover": {
13340
13387
  backgroundColor: "#515151",
13341
13388
  },
13342
13389
  color: "#ececec",
13343
13390
  };
13391
+ var iconStyle = {
13392
+ fontSize: buttonStyle.fontSize,
13393
+ };
13344
13394
  useEffect(function () {
13345
13395
  if (!mapHook.map)
13346
13396
  return;
@@ -13354,16 +13404,14 @@ var MlNavigationTools = function (props) {
13354
13404
  var zoomIn = function () {
13355
13405
  if (!mapHook.map)
13356
13406
  return;
13357
- if (mapHook.map.map.transform._zoom + 0.5 <=
13358
- mapHook.map.map.transform._maxZoom) {
13407
+ if (mapHook.map.map.transform._zoom + 0.5 <= mapHook.map.map.transform._maxZoom) {
13359
13408
  mapHook.map.map.easeTo({ zoom: mapHook.map.map.transform._zoom + 0.5 });
13360
13409
  }
13361
13410
  };
13362
13411
  var zoomOut = function () {
13363
13412
  if (!mapHook.map)
13364
13413
  return;
13365
- if (mapHook.map.map.transform._zoom - 0.5 >=
13366
- mapHook.map.map.transform._minZoom) {
13414
+ if (mapHook.map.map.transform._zoom - 0.5 >= mapHook.map.map.transform._minZoom) {
13367
13415
  mapHook.map.map.easeTo({ zoom: mapHook.map.map.transform._zoom - 0.5 });
13368
13416
  }
13369
13417
  };
@@ -13393,21 +13441,36 @@ var MlNavigationTools = function (props) {
13393
13441
  }, backgroundStyle: {
13394
13442
  boxShadow: "0px 0px 18px rgba(0,0,0,.5)",
13395
13443
  } }),
13396
- React__default.createElement(Button$1, { sx: __assign(__assign({}, buttonStyle), { fontSize: mediaIsMobile ? '1.4em' : '1em', fontWeight: 600 }), onClick: adjustPitch }, pitch ? "2D" : "3D"),
13397
- React__default.createElement(MlFollowGps, { style: __assign({}, (function (_a) {
13444
+ props.show3DButton && (React__default.createElement(Button$1, { sx: __assign(__assign({}, buttonStyle), { fontSize: mediaIsMobile ? "1.4em" : "1em", fontWeight: 600 }), onClick: adjustPitch }, pitch ? "2D" : "3D")),
13445
+ props.showFollowGpsButton && (React__default.createElement(MlFollowGps, { style: __assign({}, (function (_a) {
13398
13446
  _a.color; var rest = __rest(_a, ["color"]);
13399
13447
  return rest;
13400
- })(buttonStyle)) }),
13448
+ })(buttonStyle)) })),
13449
+ props.showCenterLocationButton && (React__default.createElement(MlCenterPosition, { style: __assign({}, (function (_a) {
13450
+ _a.color; var rest = __rest(_a, ["color"]);
13451
+ return rest;
13452
+ })(buttonStyle)) })),
13401
13453
  React__default.createElement(ButtonGroup$1, { orientation: "vertical", sx: {
13402
13454
  width: "50px",
13403
13455
  border: "none",
13404
13456
  Button: { minWidth: "20px !important", border: "none", padding: 0 },
13405
13457
  "Button:hover": { border: "none" },
13406
- } },
13407
- React__default.createElement(Button$1, { sx: __assign(__assign({}, buttonStyle), { color: "#ececec" }), onClick: zoomIn },
13408
- React__default.createElement(default_1$3, { sx: { fontSize: mediaIsMobile ? "1.5em" : "1.2em" } })),
13409
- React__default.createElement(Button$1, { sx: __assign(__assign({}, buttonStyle), { color: "#ececec" }), onClick: zoomOut },
13410
- React__default.createElement(default_1$2, { sx: { fontSize: mediaIsMobile ? "1.5em" : "1.2em" } })))));
13458
+ } }, props.showZoomButtons && (React__default.createElement(React__default.Fragment, null,
13459
+ React__default.createElement(Button$1, { sx: __assign({}, buttonStyle), onClick: zoomIn },
13460
+ React__default.createElement(default_1$3, { sx: __assign({}, iconStyle) })),
13461
+ React__default.createElement(Button$1, { sx: __assign({}, buttonStyle), onClick: zoomOut },
13462
+ React__default.createElement(default_1$2, { sx: __assign({}, iconStyle) }))))),
13463
+ props.children &&
13464
+ React__default.cloneElement(props.children, {
13465
+ sx: __assign({}, buttonStyle),
13466
+ })));
13467
+ };
13468
+ MlNavigationTools.defaultProps = {
13469
+ mapId: undefined,
13470
+ show3DButton: true,
13471
+ showFollowGpsButton: true,
13472
+ showCenterLocationButton: false,
13473
+ showZoomButtons: true,
13411
13474
  };
13412
13475
 
13413
13476
  /**