@dynatrace/strato-geo 1.2.1 → 1.4.2
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/esm/map/MapView.js +31 -24
- package/esm/map/MapView.js.map +2 -2
- package/esm/map/components/MapContent.js +43 -4
- package/esm/map/components/MapContent.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapResetButton.js +6 -1
- package/esm/map/components/toolbar/buttons/MapResetButton.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js +4 -4
- package/esm/map/components/toolbar/buttons/MapZoomInOutButtons.js.map +2 -2
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js +6 -1
- package/esm/map/components/toolbar/buttons/MapZoomToFitButton.js.map +2 -2
- package/esm/map/components/toolbar/utils/zoom-state-utils.js +36 -0
- package/esm/map/components/toolbar/utils/zoom-state-utils.js.map +7 -0
- package/esm/map/constants.js +6 -0
- package/esm/map/constants.js.map +2 -2
- package/esm/map/contexts/map-data-bounding-box.context.js +3 -1
- package/esm/map/contexts/map-data-bounding-box.context.js.map +2 -2
- package/esm/map/hooks/use-active-interaction.js +16 -12
- package/esm/map/hooks/use-active-interaction.js.map +2 -2
- package/esm/map/hooks/use-resolve-color.js +5 -2
- package/esm/map/hooks/use-resolve-color.js.map +2 -2
- package/esm/map/providers/color-scale.provider.js +2 -1
- package/esm/map/providers/color-scale.provider.js.map +2 -2
- package/esm/map/providers/imperative-handler.provider.js +7 -1
- package/esm/map/providers/imperative-handler.provider.js.map +2 -2
- package/esm/map/store/map-store.context.js +7 -1
- package/esm/map/store/map-store.context.js.map +2 -2
- package/esm/map/store/selectors.js +2 -0
- package/esm/map/store/selectors.js.map +2 -2
- package/esm/map/store/store.js +13 -0
- package/esm/map/store/store.js.map +2 -2
- package/esm/map/utils/build-scale-from-legend-config.js +4 -2
- package/esm/map/utils/build-scale-from-legend-config.js.map +2 -2
- package/esm/map/utils/extract-layers-data.js +4 -4
- package/esm/map/utils/extract-layers-data.js.map +2 -2
- package/esm/map/utils/get-data-layers-bounding-box.js +1 -1
- package/esm/map/utils/get-data-layers-bounding-box.js.map +2 -2
- package/esm/map/utils/iterate-config-slots.js +7 -1
- package/esm/map/utils/iterate-config-slots.js.map +2 -2
- package/esm/map/utils/replace-infinite-values-in-ranges.js +30 -0
- package/esm/map/utils/replace-infinite-values-in-ranges.js.map +7 -0
- package/esm/map/utils/to-mapbox-initial-view-state.js.map +2 -2
- package/index.js +3 -3
- package/map/MapView.js +31 -24
- package/map/components/MapContent.js +36 -2
- package/map/components/toolbar/buttons/MapResetButton.js +6 -1
- package/map/components/toolbar/buttons/MapZoomInOutButtons.js +4 -4
- package/map/components/toolbar/buttons/MapZoomToFitButton.js +6 -1
- package/map/components/toolbar/utils/zoom-state-utils.d.ts +4 -0
- package/map/components/toolbar/utils/zoom-state-utils.js +47 -0
- package/map/constants.d.ts +5 -1
- package/map/constants.js +6 -0
- package/map/contexts/map-data-bounding-box.context.d.ts +2 -1
- package/map/contexts/map-data-bounding-box.context.js +3 -1
- package/map/hooks/use-active-interaction.js +16 -12
- package/map/hooks/use-data-bounding-box.d.ts +1 -1
- package/map/hooks/use-resolve-color.js +1 -1
- package/map/providers/color-scale.provider.d.ts +3 -1
- package/map/providers/color-scale.provider.js +2 -1
- package/map/providers/imperative-handler.provider.js +7 -1
- package/map/store/map-store.context.d.ts +6 -0
- package/map/store/map-store.context.js +7 -1
- package/map/store/selectors.d.ts +1 -0
- package/map/store/selectors.js +2 -0
- package/map/store/store.d.ts +2 -1
- package/map/store/store.js +13 -0
- package/map/types/map-view.d.ts +2 -0
- package/map/types/state.d.ts +8 -0
- package/map/utils/build-scale-from-legend-config.d.ts +1 -1
- package/map/utils/build-scale-from-legend-config.js +4 -2
- package/map/utils/extract-layers-data.js +4 -4
- package/map/utils/get-data-layers-bounding-box.d.ts +2 -1
- package/map/utils/get-data-layers-bounding-box.js +1 -1
- package/map/utils/iterate-config-slots.js +7 -1
- package/map/utils/replace-infinite-values-in-ranges.d.ts +6 -0
- package/map/{components/legend/utils/resolve-color.js → utils/replace-infinite-values-in-ranges.js} +27 -18
- package/map/utils/to-mapbox-initial-view-state.d.ts +6 -4
- package/package.json +4 -4
- package/esm/map/components/legend/utils/resolve-color.js +0 -21
- package/esm/map/components/legend/utils/resolve-color.js.map +0 -7
- package/map/components/legend/utils/resolve-color.d.ts +0 -8
package/esm/map/MapView.js
CHANGED
|
@@ -85,34 +85,41 @@ const _MapView = forwardRef(
|
|
|
85
85
|
{
|
|
86
86
|
value: truncationMode ?? DEFAULT_TRUNCATION_MODE
|
|
87
87
|
},
|
|
88
|
-
/* @__PURE__ */ React.createElement(FormatterContext.Provider, { value: formatter }, /* @__PURE__ */ React.createElement(MapRawDataContext.Provider, { value: layersData }, /* @__PURE__ */ React.createElement(MapStoreProvider, null, /* @__PURE__ */ React.createElement(
|
|
89
|
-
|
|
88
|
+
/* @__PURE__ */ React.createElement(FormatterContext.Provider, { value: formatter }, /* @__PURE__ */ React.createElement(MapRawDataContext.Provider, { value: layersData }, /* @__PURE__ */ React.createElement(MapStoreProvider, null, /* @__PURE__ */ React.createElement(
|
|
89
|
+
ColorScaleProvider,
|
|
90
90
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
errorState,
|
|
94
|
-
showLoader: loading || isLoading
|
|
91
|
+
categories,
|
|
92
|
+
dataMax: legendDomain[1]
|
|
95
93
|
},
|
|
96
|
-
/* @__PURE__ */ React.createElement(
|
|
97
|
-
|
|
94
|
+
/* @__PURE__ */ React.createElement(LayerColorStrategyProvider, null, /* @__PURE__ */ React.createElement(
|
|
95
|
+
ChartLayout,
|
|
98
96
|
{
|
|
99
|
-
ref:
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
ref: chartLayoutRef,
|
|
98
|
+
chartHeight,
|
|
99
|
+
errorState,
|
|
100
|
+
showLoader: loading || isLoading
|
|
102
101
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
/* @__PURE__ */ React.createElement(ChartLayout.Graph, null, baseFeatureCollection && /* @__PURE__ */ React.createElement(
|
|
103
|
+
MapContent,
|
|
104
|
+
{
|
|
105
|
+
ref: forwardedRef,
|
|
106
|
+
onMapLoad: () => setIsMapLoaded(true),
|
|
107
|
+
...remaining
|
|
108
|
+
},
|
|
109
|
+
parsedChildren
|
|
110
|
+
)),
|
|
111
|
+
!isLegendHidden && /* @__PURE__ */ React.createElement(
|
|
112
|
+
ChartLayout.Legend,
|
|
113
|
+
{
|
|
114
|
+
position: legendPosition,
|
|
115
|
+
ratio: legendRatio,
|
|
116
|
+
ratioBoundaries: DEFAULT_LEGEND_SIZES,
|
|
117
|
+
onResize: legendOnRatioChange
|
|
118
|
+
},
|
|
119
|
+
/* @__PURE__ */ React.createElement(MapLegendRenderer, null)
|
|
120
|
+
)
|
|
121
|
+
))
|
|
122
|
+
))))
|
|
116
123
|
)))
|
|
117
124
|
))
|
|
118
125
|
);
|
package/esm/map/MapView.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/map/MapView.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { forwardRef, type PropsWithChildren, useState } from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n _useAutoLegendRefresh as useAutoLegendRefresh,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { MapUnavailable } from './components/MapUnavailable.js';\nimport {\n DEFAULT_LEGEND_SIZES,\n DEFAULT_MAP_HEIGHT,\n DEFAULT_TRUNCATION_MODE,\n} from './constants.js';\nimport { FormatterContext } from './contexts/formatter.context.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapBaseLayerFeaturesContext } from './contexts/map-base-layer.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapLoadingContext } from './contexts/map-loading.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { MapTruncationModeContext } from './contexts/map-truncation-mode.context.js';\nimport { useLoadMapBaseLayer } from './hooks/use-load-map-base-layer.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\nimport { extractLayersData } from './utils/extract-layers-data.js';\nimport { getMapStatesTemplates } from './utils/get-map-states-template.js';\nimport { iterateConfigSlots } from './utils/iterate-config-slots.js';\nimport { setLayersId } from './utils/set-layers-id.js';\n\n// eslint-disable-next-line no-restricted-imports\nimport './styles/react-mapgl-styles.css';\n\n/**\n * MapView Component\n */\nconst _MapView = forwardRef<MapViewRef, PropsWithChildren<MapViewProps>>(\n (props, forwardedRef) => {\n const {\n children,\n loading = false,\n style: costumerStyle,\n className: customerClassNames,\n formatter,\n truncationMode,\n ...remaining\n } = props;\n const { layerIds, parsedChildren, valueAccessors } = setLayersId(children);\n\n const {\n flattenData: layersData,\n categories,\n legendDomain,\n } = extractLayersData(parsedChildren, valueAccessors);\n\n const config = iterateConfigSlots(children, legendDomain);\n\n const isLegendHidden = !config.legend || !!config.legend.hidden;\n const legendPosition = config.legend?.position;\n const legendRatio = config.legend?.ratio;\n const legendOnRatioChange = config.legend?.onRatioChange;\n\n const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } =\n useLoadMapBaseLayer(config.baseLayer);\n\n const [isMapLoaded, setIsMapLoaded] = useState<boolean>(false);\n const { errorState } = getMapStatesTemplates(children);\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n\n const chartLayoutRef = useAutoLegendRefresh(layersData);\n const mapUnavailable = (!isFetchingFeatures && !isMapEnabled) || error;\n\n const isLoading = isFetchingFeatures || !isMapLoaded;\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-testid=\"mapview-container\"\n >\n {\n // TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response\n mapUnavailable ? (\n <MapUnavailable\n isFetchingFeatures={isFetchingFeatures}\n isDisabled={!isMapEnabled}\n chartHeight={chartHeight}\n error={error}\n />\n ) : (\n <MapLoadingContext.Provider value={loading}>\n <MapBaseLayerFeaturesContext.Provider\n value={baseFeatureCollection}\n >\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapTruncationModeContext.Provider\n value={truncationMode ?? DEFAULT_TRUNCATION_MODE}\n >\n <FormatterContext.Provider value={formatter}>\n <MapRawDataContext.Provider value={layersData}>\n <MapStoreProvider>\n <ColorScaleProvider
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,YAAoC,gBAAgB;AAEpE;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,OACpB;AAEP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAC3C,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAEjC,SAAS,yBAAyB;AAClC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AACnC,SA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UACC,OAAO;AAAA;AAAA,QAEP,oCAAC,wBAAwB,UAAxB,EAAiC,OAAO,UACvC,oCAAC,gBAAgB,UAAhB,EAAyB,OAAO,YAC/B;AAAA,UAAC,yBAAyB;AAAA,UAAzB;AAAA,YACC,OAAO,kBAAkB;AAAA;AAAA,UAEzB,oCAAC,iBAAiB,UAAjB,EAA0B,OAAO,aAChC,oCAAC,kBAAkB,UAAlB,EAA2B,OAAO,cACjC,oCAAC,wBACC,
|
|
4
|
+
"sourcesContent": ["import React, { forwardRef, type PropsWithChildren, useState } from 'react';\n\nimport {\n _ChartLayout as ChartLayout,\n _coerceSizeValue as coerceSizeValue,\n _useAutoLegendRefresh as useAutoLegendRefresh,\n} from '@dynatrace/strato-components-preview/charts';\n\nimport { MapLegendRenderer } from './components/legend/MapLegendRenderer.js';\nimport { MapContent } from './components/MapContent.js';\nimport { MapUnavailable } from './components/MapUnavailable.js';\nimport {\n DEFAULT_LEGEND_SIZES,\n DEFAULT_MAP_HEIGHT,\n DEFAULT_TRUNCATION_MODE,\n} from './constants.js';\nimport { FormatterContext } from './contexts/formatter.context.js';\nimport { LayerIdsContext } from './contexts/layer-ids.context.js';\nimport { MapBaseLayerFeaturesContext } from './contexts/map-base-layer.context.js';\nimport { MapConfigurationContext } from './contexts/map-configuration.context.js';\nimport { MapLoadingContext } from './contexts/map-loading.context.js';\nimport { MapRawDataContext } from './contexts/map-raw-data.context.js';\nimport { MapTruncationModeContext } from './contexts/map-truncation-mode.context.js';\nimport { useLoadMapBaseLayer } from './hooks/use-load-map-base-layer.js';\nimport { ColorScaleProvider } from './providers/color-scale.provider.js';\nimport { LayerColorStrategyProvider } from './providers/layer-color-strategy.provider.js';\nimport { ErrorStateSlot } from './slots/states/ErrorStateSlot.js';\nimport { MapStoreProvider } from './store/map-store.provider.js';\nimport type { MapViewProps, MapViewRef } from './types/map-view.js';\nimport { extractLayersData } from './utils/extract-layers-data.js';\nimport { getMapStatesTemplates } from './utils/get-map-states-template.js';\nimport { iterateConfigSlots } from './utils/iterate-config-slots.js';\nimport { setLayersId } from './utils/set-layers-id.js';\n\n// eslint-disable-next-line no-restricted-imports\nimport './styles/react-mapgl-styles.css';\n\n/**\n * MapView Component\n */\nconst _MapView = forwardRef<MapViewRef, PropsWithChildren<MapViewProps>>(\n (props, forwardedRef) => {\n const {\n children,\n loading = false,\n style: costumerStyle,\n className: customerClassNames,\n formatter,\n truncationMode,\n ...remaining\n } = props;\n const { layerIds, parsedChildren, valueAccessors } = setLayersId(children);\n\n const {\n flattenData: layersData,\n categories,\n legendDomain,\n } = extractLayersData(parsedChildren, valueAccessors);\n\n const config = iterateConfigSlots(children, legendDomain);\n\n const isLegendHidden = !config.legend || !!config.legend.hidden;\n const legendPosition = config.legend?.position;\n const legendRatio = config.legend?.ratio;\n const legendOnRatioChange = config.legend?.onRatioChange;\n\n const { isMapEnabled, isFetchingFeatures, baseFeatureCollection, error } =\n useLoadMapBaseLayer(config.baseLayer);\n\n const [isMapLoaded, setIsMapLoaded] = useState<boolean>(false);\n const { errorState } = getMapStatesTemplates(children);\n\n const chartHeight = coerceSizeValue(props.height) || DEFAULT_MAP_HEIGHT;\n\n const containerStyles = { width: '100%', ...costumerStyle };\n\n const chartLayoutRef = useAutoLegendRefresh(layersData);\n const mapUnavailable = (!isFetchingFeatures && !isMapEnabled) || error;\n\n const isLoading = isFetchingFeatures || !isMapLoaded;\n\n return (\n <div\n style={containerStyles}\n className={customerClassNames}\n data-testid=\"mapview-container\"\n >\n {\n // TODO: Error boundaries global fix needed - this error state only purpose is to make map not rendering when there error in response\n mapUnavailable ? (\n <MapUnavailable\n isFetchingFeatures={isFetchingFeatures}\n isDisabled={!isMapEnabled}\n chartHeight={chartHeight}\n error={error}\n />\n ) : (\n <MapLoadingContext.Provider value={loading}>\n <MapBaseLayerFeaturesContext.Provider\n value={baseFeatureCollection}\n >\n <MapConfigurationContext.Provider value={config}>\n <LayerIdsContext.Provider value={layerIds}>\n <MapTruncationModeContext.Provider\n value={truncationMode ?? DEFAULT_TRUNCATION_MODE}\n >\n <FormatterContext.Provider value={formatter}>\n <MapRawDataContext.Provider value={layersData}>\n <MapStoreProvider>\n <ColorScaleProvider\n categories={categories}\n dataMax={legendDomain[1]}\n >\n <LayerColorStrategyProvider>\n <ChartLayout\n ref={chartLayoutRef}\n chartHeight={chartHeight}\n errorState={errorState}\n showLoader={loading || isLoading}\n >\n <ChartLayout.Graph>\n {baseFeatureCollection && (\n <MapContent\n ref={forwardedRef}\n onMapLoad={() => setIsMapLoaded(true)}\n {...remaining}\n >\n {parsedChildren}\n </MapContent>\n )}\n </ChartLayout.Graph>\n {!isLegendHidden && (\n <ChartLayout.Legend\n position={legendPosition}\n ratio={legendRatio}\n ratioBoundaries={DEFAULT_LEGEND_SIZES}\n onResize={legendOnRatioChange}\n >\n <MapLegendRenderer />\n </ChartLayout.Legend>\n )}\n </ChartLayout>\n </LayerColorStrategyProvider>\n </ColorScaleProvider>\n </MapStoreProvider>\n </MapRawDataContext.Provider>\n </FormatterContext.Provider>\n </MapTruncationModeContext.Provider>\n </LayerIdsContext.Provider>\n </MapConfigurationContext.Provider>\n </MapBaseLayerFeaturesContext.Provider>\n </MapLoadingContext.Provider>\n )\n }\n </div>\n );\n },\n);\n\n(_MapView as typeof _MapView & { displayName: string })['displayName'] =\n 'MapView';\n\n/**\n * The `MapView` is a component that renders a map with various geospatial data layers.\n * @public\n */\nexport const MapView = Object.assign(_MapView, {\n ErrorState: ErrorStateSlot,\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,YAAoC,gBAAgB;AAEpE;AAAA,EACE,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,OACpB;AAEP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,mCAAmC;AAC5C,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O,OAAO,UAAU;AAAA,EAC7C,YAAY;AACd,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Layer,
|
|
3
|
+
Map,
|
|
4
|
+
Source
|
|
5
|
+
} from "@vis.gl/react-maplibre";
|
|
2
6
|
import { isUndefined } from "lodash-es";
|
|
3
7
|
import React, {
|
|
4
8
|
forwardRef,
|
|
5
9
|
useContext,
|
|
6
|
-
useRef
|
|
10
|
+
useRef,
|
|
11
|
+
useState
|
|
7
12
|
} from "react";
|
|
8
13
|
import { _useGraphSize as useGraphSize } from "@dynatrace/strato-components-preview/charts";
|
|
9
14
|
import { useMergeRefs } from "@dynatrace/strato-components-preview/core";
|
|
@@ -19,6 +24,7 @@ import {
|
|
|
19
24
|
MAX_LONGITUDE,
|
|
20
25
|
MAX_LATITUDE
|
|
21
26
|
} from "../constants.js";
|
|
27
|
+
import { useMapZoomState, useSetStateZoom } from "../store/store.js";
|
|
22
28
|
import { MapToolbar } from "./toolbar/MapToolbar.js";
|
|
23
29
|
import { LayerIdsContext } from "../contexts/layer-ids.context.js";
|
|
24
30
|
import { MapDataBoundingBoxContext } from "../contexts/map-data-bounding-box.context.js";
|
|
@@ -36,6 +42,7 @@ import { getColorFromToken } from "../utils/get-color-from-token.js";
|
|
|
36
42
|
import { getDataLayersBoundingBox } from "../utils/get-data-layers-bounding-box.js";
|
|
37
43
|
import { toMapBoxInitialViewState } from "../utils/to-mapbox-initial-view-state.js";
|
|
38
44
|
import { useSetMapInitialConfiguration } from "../utils/use-set-map-initial-configuration.js";
|
|
45
|
+
import { generateNewZoomState } from "./toolbar/utils/zoom-state-utils.js";
|
|
39
46
|
const lineLayer = {
|
|
40
47
|
id: BASE_LAYER_LINE_ID,
|
|
41
48
|
type: "line"
|
|
@@ -92,6 +99,8 @@ const MapContent = forwardRef((props, forwardedRef) => {
|
|
|
92
99
|
...remaining
|
|
93
100
|
} = props;
|
|
94
101
|
const loading = useMapLoading();
|
|
102
|
+
const setZoomState = useSetStateZoom();
|
|
103
|
+
const [savedInitialViewState, setSavedInitialViewState] = useState();
|
|
95
104
|
const mapContainerRef = useRef(null);
|
|
96
105
|
const mergedRefs = useMergeRefs([
|
|
97
106
|
mapContainerRef,
|
|
@@ -117,6 +126,28 @@ const MapContent = forwardRef((props, forwardedRef) => {
|
|
|
117
126
|
} = useOverlayEvents();
|
|
118
127
|
const initialViewState = initialViewStateProp ?? dataLayersBBox;
|
|
119
128
|
const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);
|
|
129
|
+
const calculatedInitialViewState = toMapBoxInitialViewState(initialViewState);
|
|
130
|
+
const { zoomToFitInProgress } = useMapZoomState();
|
|
131
|
+
const handleZoomEnd = (event) => {
|
|
132
|
+
if (savedInitialViewState) {
|
|
133
|
+
const zoomState = generateNewZoomState(
|
|
134
|
+
event,
|
|
135
|
+
savedInitialViewState,
|
|
136
|
+
zoomToFitInProgress
|
|
137
|
+
);
|
|
138
|
+
setZoomState(zoomState);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const handleDragEnd = (event) => {
|
|
142
|
+
if (savedInitialViewState) {
|
|
143
|
+
const zoomState = generateNewZoomState(
|
|
144
|
+
event,
|
|
145
|
+
savedInitialViewState,
|
|
146
|
+
zoomToFitInProgress
|
|
147
|
+
);
|
|
148
|
+
setZoomState(zoomState);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
120
151
|
return /* @__PURE__ */ React.createElement(
|
|
121
152
|
"div",
|
|
122
153
|
{
|
|
@@ -131,7 +162,7 @@ const MapContent = forwardRef((props, forwardedRef) => {
|
|
|
131
162
|
onMove: (evt) => {
|
|
132
163
|
onViewStateChange?.(evt.viewState);
|
|
133
164
|
},
|
|
134
|
-
initialViewState:
|
|
165
|
+
initialViewState: calculatedInitialViewState,
|
|
135
166
|
style: {
|
|
136
167
|
width: graphWidth,
|
|
137
168
|
height: `${graphHeight}px`,
|
|
@@ -149,12 +180,20 @@ const MapContent = forwardRef((props, forwardedRef) => {
|
|
|
149
180
|
onMouseMove: (e) => handleMouseMove(e),
|
|
150
181
|
onClick: (e) => handleMouseClick(e),
|
|
151
182
|
onZoom: handleZoom,
|
|
183
|
+
onZoomEnd: handleZoomEnd,
|
|
152
184
|
onDrag: handleDrag,
|
|
185
|
+
onDragEnd: handleDragEnd,
|
|
153
186
|
attributionControl: false,
|
|
154
187
|
onRender: () => onRenderHandler && onRenderHandler(),
|
|
155
|
-
onLoad: () => {
|
|
188
|
+
onLoad: (e) => {
|
|
156
189
|
onMapLoad();
|
|
157
190
|
onLoadHandler && onLoadHandler();
|
|
191
|
+
const initialCenter = e.target.getCenter();
|
|
192
|
+
setSavedInitialViewState({
|
|
193
|
+
latitude: initialCenter.lat,
|
|
194
|
+
longitude: initialCenter.lng,
|
|
195
|
+
zoom: e.target.getZoom()
|
|
196
|
+
});
|
|
158
197
|
},
|
|
159
198
|
ref: useSetMapInitialConfiguration(),
|
|
160
199
|
interactive: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/components/MapContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n Layer,\n type LayerProps,\n Map,\n Source,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\nimport { isUndefined } from 'lodash-es';\nimport type { MapLayerMouseEvent } from 'maplibre-gl';\nimport React, {\n forwardRef,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport { _useGraphSize as useGraphSize } from '@dynatrace/strato-components-preview/charts';\nimport { useMergeRefs } from '@dynatrace/strato-components-preview/core';\n\nimport {\n BASE_LAYER_FILL_ID,\n BASE_LAYER_LINE_ID,\n DEFAULT_BOUNDARIES_BORDER_COLOR,\n DEFAULT_COUNTRIES_FILL_COLOR,\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n MIN_LONGITUDE,\n MIN_LATITUDE,\n MAX_LONGITUDE,\n MAX_LATITUDE,\n} from '../constants.js';\nimport { useMapZoomState, useSetStateZoom } from '../store/store.js';\nimport { MapToolbar } from './toolbar/MapToolbar.js';\nimport { LayerIdsContext } from '../contexts/layer-ids.context.js';\nimport { MapDataBoundingBoxContext } from '../contexts/map-data-bounding-box.context.js';\nimport { useActiveInteraction } from '../hooks/use-active-interaction.js';\nimport { useHoverInteraction } from '../hooks/use-hover-interaction.js';\nimport { useMapBaseLayerFeatures } from '../hooks/use-map-base-layer-features.js';\nimport { useMapConfig } from '../hooks/use-map-config.js';\nimport { useMapLoading } from '../hooks/use-map-loading.js';\nimport { useMapPerformance } from '../hooks/use-map-performance.js';\nimport { useOverlayEvents } from '../hooks/use-overlay-events.js';\nimport { useTooltipEventListeners } from '../hooks/use-tooltip-event-listeners.js';\nimport { defaultStyle } from '../map-styles/default-style.js';\nimport { MapViewImperativeHandler } from '../providers/imperative-handler.provider.js';\nimport type {\n MapViewProps,\n MapViewRef,\n ViewStateRequired,\n} from '../types/map-view.js';\nimport { getColorFromToken } from '../utils/get-color-from-token.js';\nimport { getDataLayersBoundingBox } from '../utils/get-data-layers-bounding-box.js';\nimport { toMapBoxInitialViewState } from '../utils/to-mapbox-initial-view-state.js';\nimport { useSetMapInitialConfiguration } from '../utils/use-set-map-initial-configuration.js';\nimport { generateNewZoomState } from './toolbar/utils/zoom-state-utils.js';\n\nconst lineLayer: LayerProps = {\n id: BASE_LAYER_LINE_ID,\n type: 'line',\n};\n\nconst fillLayer: LayerProps = {\n id: BASE_LAYER_FILL_ID,\n type: 'fill',\n};\n\nconst MapSource = () => {\n const baseLayerFeatures = useMapBaseLayerFeatures();\n return (\n baseLayerFeatures && (\n <Source id=\"data\" type=\"geojson\" data={baseLayerFeatures}>\n <Layer\n {...fillLayer}\n paint={{\n 'fill-color': getColorFromToken(DEFAULT_COUNTRIES_FILL_COLOR),\n }}\n />\n <Layer\n {...lineLayer}\n type={'line'}\n filter={[\n 'any',\n ['==', 'region_type', 'COUNTRY'],\n ['==', 'region_type', 'REGION'],\n ]}\n paint={{\n 'line-color': getColorFromToken(DEFAULT_BOUNDARIES_BORDER_COLOR),\n 'line-width': [\n 'case',\n ['==', ['get', 'region_type'], 'REGION'],\n REGION_BORDER_WIDTH,\n COUNTRY_BORDER_WIDTH,\n ],\n }}\n />\n </Source>\n )\n );\n};\n\nconst MapInteractions = ({ children }: PropsWithChildren) => {\n useHoverInteraction();\n useActiveInteraction();\n\n return children;\n};\ntype MapContentProps = MapViewProps & {\n onMapLoad: () => void;\n};\n\nexport const MapContent = forwardRef<\n MapViewRef,\n PropsWithChildren<MapContentProps>\n>((props, forwardedRef) => {\n const {\n initialViewState: initialViewStateProp,\n children,\n style,\n mapStyle = defaultStyle,\n onViewStateChange,\n onMapLoad,\n ...remaining\n } = props;\n\n const loading = useMapLoading();\n const setZoomState = useSetStateZoom();\n const [savedInitialViewState, setSavedInitialViewState] = useState<\n ViewStateRequired | undefined\n >();\n\n const mapContainerRef = useRef<HTMLDivElement>(null);\n const mergedRefs = useMergeRefs<MapViewRef | HTMLDivElement>([\n mapContainerRef,\n forwardedRef,\n ]);\n\n const baseFeatureCollection = useMapBaseLayerFeatures();\n\n const dataLayersBBox = getDataLayersBoundingBox(\n children,\n baseFeatureCollection?.features,\n );\n\n useTooltipEventListeners();\n\n const { toolbar: toolbarConfig, interactions: interactionsConfig } =\n useMapConfig();\n const layerIds = useContext(LayerIdsContext);\n const shouldRenderToolbar =\n !isUndefined(toolbarConfig) || !isUndefined(interactionsConfig);\n\n const { height: graphHeight, width: graphWidth } = useGraphSize();\n\n const {\n handleMouseEnter,\n handleMouseMove,\n handleMouseLeave,\n handleMouseClick,\n handleZoom,\n handleDrag,\n } = useOverlayEvents();\n\n const initialViewState = initialViewStateProp ?? dataLayersBBox;\n\n const { onLoadHandler, onRenderHandler } = useMapPerformance(mapContainerRef);\n const calculatedInitialViewState = toMapBoxInitialViewState(initialViewState);\n\n const { zoomToFitInProgress } = useMapZoomState();\n\n const handleZoomEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n const handleDragEnd = (event: ViewStateChangeEvent) => {\n if (savedInitialViewState) {\n const zoomState = generateNewZoomState(\n event,\n savedInitialViewState,\n zoomToFitInProgress,\n );\n\n setZoomState(zoomState);\n }\n };\n\n return (\n <div\n data-testid=\"map-container\"\n ref={mergedRefs}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Map\n onMove={(evt) => {\n onViewStateChange?.(evt.viewState);\n }}\n initialViewState={calculatedInitialViewState}\n style={{\n width: graphWidth,\n height: `${graphHeight}px`,\n ...style,\n }}\n mapStyle={mapStyle}\n dragRotate={false}\n fadeDuration={0}\n renderWorldCopies={false}\n interactiveLayerIds={layerIds}\n maxBounds={[\n [MIN_LONGITUDE, MIN_LATITUDE],\n [MAX_LONGITUDE, MAX_LATITUDE],\n ]}\n onMouseMove={(e) => handleMouseMove(e as MapLayerMouseEvent)}\n onClick={(e) => handleMouseClick(e as MapLayerMouseEvent)}\n onZoom={handleZoom}\n onZoomEnd={handleZoomEnd}\n onDrag={handleDrag}\n onDragEnd={handleDragEnd}\n attributionControl={false}\n onRender={() => onRenderHandler && onRenderHandler()}\n onLoad={(e) => {\n onMapLoad();\n onLoadHandler && onLoadHandler();\n\n const initialCenter = e.target.getCenter();\n\n setSavedInitialViewState({\n latitude: initialCenter.lat,\n longitude: initialCenter.lng,\n zoom: e.target.getZoom(),\n });\n }}\n ref={useSetMapInitialConfiguration()}\n interactive\n {...remaining}\n >\n <MapDataBoundingBoxContext.Provider value={dataLayersBBox}>\n <MapViewImperativeHandler\n forwardedRef={forwardedRef}\n containerRef={mapContainerRef}\n >\n <MapSource />\n {loading ? null : (\n <>\n <MapInteractions>{children}</MapInteractions>\n {shouldRenderToolbar ? <MapToolbar /> : null}\n </>\n )}\n </MapViewImperativeHandler>\n </MapDataBoundingBoxContext.Provider>\n </Map>\n </div>\n );\n});\n\n(MapContent as typeof MapContent & { displayName: string }).displayName =\n 'MapContent';\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,mBAAmB;AAE5B,OAAO;AAAA,EACL;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,oBAAoB;AAE7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAC1C,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,+BAA+B;AACxC,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAMzC,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,qCAAqC;AAC9C,SAAS,4BAA4B;AAErC,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAwB;AAAA,EAC5B,IAAI;AAAA,EACJ,MAAM;AACR;AAEA,MAAM,YAAY,MAAM;AACtB,QAAM,oBAAoB,wBAAwB;AAClD,SACE,qBACE,oCAAC,UAAO,IAAG,QAAO,MAAK,WAAU,MAAM,qBACrC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AA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;AAAA,QACX,oBAAoB;AAAA,QACpB,UAAU,MAAM,mBAAmB,gBAAgB;AAAA,QACnD,QAAQ,CAAC,MAAM;AACb,oBAAU;AACV,2BAAiB,cAAc;AAE/B,gBAAM,gBAAgB,EAAE,OAAO,UAAU;AAEzC,mCAAyB;AAAA,YACvB,UAAU,cAAc;AAAA,YACxB,WAAW,cAAc;AAAA,YACzB,MAAM,EAAE,OAAO,QAAQ;AAAA,UACzB,CAAC;AAAA,QACH;AAAA,QACA,KAAK,8BAA8B;AAAA,QACnC,aAAW;AAAA,QACV,GAAG;AAAA;AAAA,MAEJ,oCAAC,0BAA0B,UAA1B,EAAmC,OAAO,kBACzC;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,cAAc;AAAA;AAAA,QAEd,oCAAC,eAAU;AAAA,QACV,UAAU,OACT,0DACE,oCAAC,uBAAiB,QAAS,GAC1B,sBAAsB,oCAAC,gBAAW,IAAK,IAC1C;AAAA,MAEJ,CACF;AAAA,IACF;AAAA,EACF;AAEJ,CAAC;AAEA,WAA2D,cAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,16 +4,20 @@ import { useIntl } from "react-intl";
|
|
|
4
4
|
import { _ChartToolbarRenderer as ChartToolbarRenderer } from "@dynatrace/strato-components-preview/charts";
|
|
5
5
|
import { ResetIcon } from "@dynatrace/strato-icons";
|
|
6
6
|
import { useInitialViewContext } from "../../../hooks/use-initial-view-context.js";
|
|
7
|
+
import { useMapZoomState, useSetStateZoom } from "../../../store/store.js";
|
|
7
8
|
import { TOOLBAR_MESSAGES } from "../constants.js";
|
|
8
9
|
import { useA11yToolbarTabIndex } from "../hooks/use-a11y-toolbar-tab-index.js";
|
|
9
10
|
const MapResetButton = () => {
|
|
10
11
|
const { current: map } = useMap();
|
|
11
12
|
const { longitude = 0, latitude = 0, zoom = 0 } = useInitialViewContext();
|
|
12
13
|
const intl = useIntl();
|
|
14
|
+
const { resetEnabled } = useMapZoomState();
|
|
15
|
+
const setZoomState = useSetStateZoom();
|
|
13
16
|
const resetButtonRef = useRef();
|
|
14
17
|
const tabIndex = useA11yToolbarTabIndex("reset");
|
|
15
18
|
const handleReset = () => {
|
|
16
19
|
map?.flyTo({ center: [longitude, latitude], zoom });
|
|
20
|
+
setZoomState({ zoomToFitEnabled: true, resetEnabled: false });
|
|
17
21
|
};
|
|
18
22
|
const handleKeyDown = (event) => {
|
|
19
23
|
if (event.code === "Enter") {
|
|
@@ -29,7 +33,8 @@ const MapResetButton = () => {
|
|
|
29
33
|
testId: "map-toolbar-reset",
|
|
30
34
|
onKeyDown: handleKeyDown,
|
|
31
35
|
onClick: handleReset,
|
|
32
|
-
tabIndex
|
|
36
|
+
tabIndex,
|
|
37
|
+
disabled: !resetEnabled
|
|
33
38
|
}
|
|
34
39
|
);
|
|
35
40
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/toolbar/buttons/MapResetButton.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ResetIcon } from '@dynatrace/strato-icons';\n\nimport { useInitialViewContext } from '../../../hooks/use-initial-view-context.js';\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\nexport const MapResetButton = () => {\n const { current: map } = useMap();\n const { longitude = 0, latitude = 0, zoom = 0 } = useInitialViewContext();\n const intl = useIntl();\n\n const resetButtonRef = useRef<HTMLButtonElement>();\n const tabIndex = useA11yToolbarTabIndex('reset');\n\n const handleReset = () => {\n map?.flyTo({ center: [longitude, latitude], zoom: zoom });\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.code === 'Enter') {\n handleReset();\n }\n };\n\n return (\n <ChartToolbarRenderer.Control\n ref={resetButtonRef}\n prefixIcon={<ResetIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionReset)}\n testId=\"map-toolbar-reset\"\n onKeyDown={handleKeyDown}\n onClick={handleReset}\n tabIndex={tabIndex}\n />\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,iBAAiB;AAE1B,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEhC,MAAM,iBAAiB,MAAM;AAClC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,EAAE,YAAY,GAAG,WAAW,GAAG,OAAO,EAAE,IAAI,sBAAsB;AACxE,QAAM,OAAO,QAAQ;
|
|
4
|
+
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ResetIcon } from '@dynatrace/strato-icons';\n\nimport { useInitialViewContext } from '../../../hooks/use-initial-view-context.js';\nimport { useMapZoomState, useSetStateZoom } from '../../../store/store.js';\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\nexport const MapResetButton = () => {\n const { current: map } = useMap();\n const { longitude = 0, latitude = 0, zoom = 0 } = useInitialViewContext();\n const intl = useIntl();\n const { resetEnabled } = useMapZoomState();\n const setZoomState = useSetStateZoom();\n\n const resetButtonRef = useRef<HTMLButtonElement>();\n const tabIndex = useA11yToolbarTabIndex('reset');\n\n const handleReset = () => {\n map?.flyTo({ center: [longitude, latitude], zoom: zoom });\n setZoomState({ zoomToFitEnabled: true, resetEnabled: false });\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.code === 'Enter') {\n handleReset();\n }\n };\n\n return (\n <ChartToolbarRenderer.Control\n ref={resetButtonRef}\n prefixIcon={<ResetIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionReset)}\n testId=\"map-toolbar-reset\"\n onKeyDown={handleKeyDown}\n onClick={handleReset}\n tabIndex={tabIndex}\n disabled={!resetEnabled}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,iBAAiB;AAE1B,SAAS,6BAA6B;AACtC,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEhC,MAAM,iBAAiB,MAAM;AAClC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,EAAE,YAAY,GAAG,WAAW,GAAG,OAAO,EAAE,IAAI,sBAAsB;AACxE,QAAM,OAAO,QAAQ;AACrB,QAAM,EAAE,aAAa,IAAI,gBAAgB;AACzC,QAAM,eAAe,gBAAgB;AAErC,QAAM,iBAAiB,OAA0B;AACjD,QAAM,WAAW,uBAAuB,OAAO;AAE/C,QAAM,cAAc,MAAM;AACxB,SAAK,MAAM,EAAE,QAAQ,CAAC,WAAW,QAAQ,GAAG,KAAW,CAAC;AACxD,iBAAa,EAAE,kBAAkB,MAAM,cAAc,MAAM,CAAC;AAAA,EAC9D;AAEA,QAAM,gBAAgB,CAAC,UAA+B;AACpD,QAAI,MAAM,SAAS,SAAS;AAC1B,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,SACE;AAAA,IAAC,qBAAqB;AAAA,IAArB;AAAA,MACC,KAAK;AAAA,MACL,YAAY,oCAAC,eAAU;AAAA,MACvB,aAAa,KAAK,cAAc,iBAAiB,eAAe;AAAA,MAChE,QAAO;AAAA,MACP,WAAW;AAAA,MACX,SAAS;AAAA,MACT;AAAA,MACA,UAAU,CAAC;AAAA;AAAA,EACb;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,12 +3,12 @@ import React, { useRef } from "react";
|
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
4
|
import { _ChartToolbarRenderer as ChartToolbarRenderer } from "@dynatrace/strato-components-preview/charts";
|
|
5
5
|
import { ZoomInIcon, ZoomOutIcon } from "@dynatrace/strato-icons";
|
|
6
|
+
import { useMapZoomState } from "../../../store/selectors.js";
|
|
6
7
|
import { TOOLBAR_MESSAGES } from "../constants.js";
|
|
7
8
|
import { useA11yToolbarTabIndex } from "../hooks/use-a11y-toolbar-tab-index.js";
|
|
8
9
|
const MapZoomInOutButtons = () => {
|
|
9
10
|
const { current: map } = useMap();
|
|
10
|
-
const
|
|
11
|
-
const isMinZoom = map && map?.getMinZoom() === map?.getZoom();
|
|
11
|
+
const { zoomInEnabled, zoomOutEnabled } = useMapZoomState();
|
|
12
12
|
const zoomInButtonRef = useRef();
|
|
13
13
|
const zoomButtonOutRef = useRef();
|
|
14
14
|
const intl = useIntl();
|
|
@@ -37,7 +37,7 @@ const MapZoomInOutButtons = () => {
|
|
|
37
37
|
onKeyDown: (event) => handleZoomKeyboardMode(event, "zoom-in"),
|
|
38
38
|
onClick: () => handleZoomStepToolbarMode("zoom-in"),
|
|
39
39
|
tabIndex: tabIndexIn,
|
|
40
|
-
disabled:
|
|
40
|
+
disabled: !zoomInEnabled
|
|
41
41
|
}
|
|
42
42
|
), /* @__PURE__ */ React.createElement(
|
|
43
43
|
ChartToolbarRenderer.Control,
|
|
@@ -49,7 +49,7 @@ const MapZoomInOutButtons = () => {
|
|
|
49
49
|
onKeyDown: (event) => handleZoomKeyboardMode(event, "zoom-out"),
|
|
50
50
|
onClick: () => handleZoomStepToolbarMode("zoom-out"),
|
|
51
51
|
tabIndex: tabIndexOut,
|
|
52
|
-
disabled:
|
|
52
|
+
disabled: !zoomOutEnabled
|
|
53
53
|
}
|
|
54
54
|
));
|
|
55
55
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/toolbar/buttons/MapZoomInOutButtons.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ZoomInIcon, ZoomOutIcon } from '@dynatrace/strato-icons';\n\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\ntype ZoomBehavior = 'zoom-in' | 'zoom-out';\nexport const MapZoomInOutButtons = () => {\n const { current: map } = useMap();\n const
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,YAAY,mBAAmB;AAExC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAGhC,MAAM,sBAAsB,MAAM;AACvC,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,
|
|
4
|
+
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ZoomInIcon, ZoomOutIcon } from '@dynatrace/strato-icons';\n\nimport { useMapZoomState } from '../../../store/selectors.js';\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\ntype ZoomBehavior = 'zoom-in' | 'zoom-out';\nexport const MapZoomInOutButtons = () => {\n const { current: map } = useMap();\n const { zoomInEnabled, zoomOutEnabled } = useMapZoomState();\n\n const zoomInButtonRef = useRef<HTMLButtonElement>();\n const zoomButtonOutRef = useRef<HTMLButtonElement>();\n const intl = useIntl();\n const tabIndexIn = useA11yToolbarTabIndex('zoom-in');\n const tabIndexOut = useA11yToolbarTabIndex('zoom-out');\n\n const handleZoomKeyboardMode = (\n event: React.KeyboardEvent,\n zoomBehavior: ZoomBehavior,\n ) => {\n if (event.code === 'Enter') {\n handleZoomStepToolbarMode(zoomBehavior);\n }\n };\n\n const handleZoomStepToolbarMode = (zoomBehavior: ZoomBehavior) => {\n if (zoomBehavior === 'zoom-in') {\n map?.zoomIn();\n }\n if (zoomBehavior === 'zoom-out') {\n map?.zoomOut();\n }\n };\n\n return (\n <>\n <ChartToolbarRenderer.Control\n ref={zoomInButtonRef}\n prefixIcon={<ZoomInIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionZoomIn)}\n testId=\"map-toolbar-zoom-in\"\n onKeyDown={(event) => handleZoomKeyboardMode(event, 'zoom-in')}\n onClick={() => handleZoomStepToolbarMode('zoom-in')}\n tabIndex={tabIndexIn}\n disabled={!zoomInEnabled}\n />\n <ChartToolbarRenderer.Control\n ref={zoomButtonOutRef}\n prefixIcon={<ZoomOutIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionZoomOut)}\n testId=\"map-toolbar-zoom-out\"\n onKeyDown={(event) => handleZoomKeyboardMode(event, 'zoom-out')}\n onClick={() => handleZoomStepToolbarMode('zoom-out')}\n tabIndex={tabIndexOut}\n disabled={!zoomOutEnabled}\n />\n </>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,YAAY,mBAAmB;AAExC,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAGhC,MAAM,sBAAsB,MAAM;AACvC,QAAM,EAAE,SAAS,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on } from "@dynatrace/strato-icons";
|
|
6
6
|
import { FIT_BOUNDS_OPTIONS } from "../../../constants.js";
|
|
7
7
|
import { useDataBoundingBox } from "../../../hooks/use-data-bounding-box.js";
|
|
8
|
+
import { useMapZoomState, useSetStateZoom } from "../../../store/store.js";
|
|
8
9
|
import { TOOLBAR_MESSAGES } from "../constants.js";
|
|
9
10
|
import { useA11yToolbarTabIndex } from "../hooks/use-a11y-toolbar-tab-index.js";
|
|
10
11
|
const MapZoomToFitButton = () => {
|
|
@@ -13,8 +14,11 @@ const MapZoomToFitButton = () => {
|
|
|
13
14
|
const tabIndex = useA11yToolbarTabIndex("zoom-to-fit");
|
|
14
15
|
const intl = useIntl();
|
|
15
16
|
const boundingBox = useDataBoundingBox();
|
|
17
|
+
const { zoomToFitEnabled } = useMapZoomState();
|
|
18
|
+
const setZoomState = useSetStateZoom();
|
|
16
19
|
const handleZoomToFit = () => {
|
|
17
20
|
map?.fitBounds(boundingBox, FIT_BOUNDS_OPTIONS);
|
|
21
|
+
setZoomState({ zoomToFitEnabled: false, zoomToFitInProgress: true });
|
|
18
22
|
};
|
|
19
23
|
const handleKeyDown = (event) => {
|
|
20
24
|
if (event.code === "Enter") {
|
|
@@ -30,7 +34,8 @@ const MapZoomToFitButton = () => {
|
|
|
30
34
|
testId: "map-toolbar-zoom-to-fit",
|
|
31
35
|
onKeyDown: handleKeyDown,
|
|
32
36
|
onClick: handleZoomToFit,
|
|
33
|
-
tabIndex
|
|
37
|
+
tabIndex,
|
|
38
|
+
disabled: !zoomToFitEnabled
|
|
34
39
|
}
|
|
35
40
|
);
|
|
36
41
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/map/components/toolbar/buttons/MapZoomToFitButton.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ZoomToFitIcon } from '@dynatrace/strato-icons';\n\nimport { FIT_BOUNDS_OPTIONS } from '../../../constants.js';\nimport { useDataBoundingBox } from '../../../hooks/use-data-bounding-box.js';\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\nexport const MapZoomToFitButton = () => {\n const resetButtonRef = useRef();\n const { current: map } = useMap();\n const tabIndex = useA11yToolbarTabIndex('zoom-to-fit');\n const intl = useIntl();\n const boundingBox = useDataBoundingBox();\n const handleZoomToFit = () => {\n map?.fitBounds(boundingBox, FIT_BOUNDS_OPTIONS);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.code === 'Enter') {\n handleZoomToFit();\n }\n };\n\n return (\n <ChartToolbarRenderer.Control\n ref={resetButtonRef}\n prefixIcon={<ZoomToFitIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionZoomToFit)}\n testId=\"map-toolbar-zoom-to-fit\"\n onKeyDown={handleKeyDown}\n onClick={handleZoomToFit}\n tabIndex={tabIndex}\n />\n );\n};\n\nMapZoomToFitButton['displayName'] = 'MapZoomToFit';\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEhC,MAAM,qBAAqB,MAAM;AACtC,QAAM,iBAAiB,OAAO;AAC9B,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,WAAW,uBAAuB,aAAa;AACrD,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,mBAAmB;AACvC,QAAM,kBAAkB,MAAM;AAC5B,SAAK,UAAU,aAAa,kBAAkB;AAAA,
|
|
4
|
+
"sourcesContent": ["import { useMap } from '@vis.gl/react-maplibre';\nimport React, { useRef } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { _ChartToolbarRenderer as ChartToolbarRenderer } from '@dynatrace/strato-components-preview/charts';\nimport { ZoomToFitIcon } from '@dynatrace/strato-icons';\n\nimport { FIT_BOUNDS_OPTIONS } from '../../../constants.js';\nimport { useDataBoundingBox } from '../../../hooks/use-data-bounding-box.js';\nimport { useMapZoomState, useSetStateZoom } from '../../../store/store.js';\nimport { TOOLBAR_MESSAGES } from '../constants.js';\nimport { useA11yToolbarTabIndex } from '../hooks/use-a11y-toolbar-tab-index.js';\n\nexport const MapZoomToFitButton = () => {\n const resetButtonRef = useRef();\n const { current: map } = useMap();\n const tabIndex = useA11yToolbarTabIndex('zoom-to-fit');\n const intl = useIntl();\n const boundingBox = useDataBoundingBox();\n const { zoomToFitEnabled } = useMapZoomState();\n const setZoomState = useSetStateZoom();\n const handleZoomToFit = () => {\n map?.fitBounds(boundingBox, FIT_BOUNDS_OPTIONS);\n setZoomState({ zoomToFitEnabled: false, zoomToFitInProgress: true });\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.code === 'Enter') {\n handleZoomToFit();\n }\n };\n\n return (\n <ChartToolbarRenderer.Control\n ref={resetButtonRef}\n prefixIcon={<ZoomToFitIcon />}\n tooltipText={intl.formatMessage(TOOLBAR_MESSAGES.zoomActionZoomToFit)}\n testId=\"map-toolbar-zoom-to-fit\"\n onKeyDown={handleKeyDown}\n onClick={handleZoomToFit}\n tabIndex={tabIndex}\n disabled={!zoomToFitEnabled}\n />\n );\n};\n\nMapZoomToFitButton['displayName'] = 'MapZoomToFit';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,OAAO,SAAS,cAAc;AAC9B,SAAS,eAAe;AAExB,SAAS,yBAAyB,4BAA4B;AAC9D,SAAS,qBAAqB;AAE9B,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,wBAAwB;AACjC,SAAS,8BAA8B;AAEhC,MAAM,qBAAqB,MAAM;AACtC,QAAM,iBAAiB,OAAO;AAC9B,QAAM,EAAE,SAAS,IAAI,IAAI,OAAO;AAChC,QAAM,WAAW,uBAAuB,aAAa;AACrD,QAAM,OAAO,QAAQ;AACrB,QAAM,cAAc,mBAAmB;AACvC,QAAM,EAAE,iBAAiB,IAAI,gBAAgB;AAC7C,QAAM,eAAe,gBAAgB;AACrC,QAAM,kBAAkB,MAAM;AAC5B,SAAK,UAAU,aAAa,kBAAkB;AAC9C,iBAAa,EAAE,kBAAkB,OAAO,qBAAqB,KAAK,CAAC;AAAA,EACrE;AAEA,QAAM,gBAAgB,CAAC,UAA+B;AACpD,QAAI,MAAM,SAAS,SAAS;AAC1B,sBAAgB;AAAA,IAClB;AAAA,EACF;AAEA,SACE;AAAA,IAAC,qBAAqB;AAAA,IAArB;AAAA,MACC,KAAK;AAAA,MACL,YAAY,oCAAC,mBAAc;AAAA,MAC3B,aAAa,KAAK,cAAc,iBAAiB,mBAAmB;AAAA,MACpE,QAAO;AAAA,MACP,WAAW;AAAA,MACX,SAAS;AAAA,MACT;AAAA,MACA,UAAU,CAAC;AAAA;AAAA,EACb;AAEJ;AAEA,mBAAmB,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_BOUNDS_PRECISION,
|
|
3
|
+
MAX_LATITUDE,
|
|
4
|
+
MAX_LONGITUDE,
|
|
5
|
+
MIN_LATITUDE,
|
|
6
|
+
MIN_LONGITUDE,
|
|
7
|
+
VIEW_STATE_PRECISION
|
|
8
|
+
} from "../../../constants.js";
|
|
9
|
+
function compareViewStates(currentViewState, initialViewState) {
|
|
10
|
+
return currentViewState.zoom.toFixed(VIEW_STATE_PRECISION) === initialViewState.zoom.toFixed(VIEW_STATE_PRECISION) && currentViewState.latitude.toFixed(VIEW_STATE_PRECISION) === initialViewState.latitude.toFixed(VIEW_STATE_PRECISION) && currentViewState.longitude.toFixed(VIEW_STATE_PRECISION) === initialViewState.longitude.toFixed(VIEW_STATE_PRECISION);
|
|
11
|
+
}
|
|
12
|
+
function isMinZoomReached(currentBounds) {
|
|
13
|
+
return currentBounds._ne.lat.toFixed(MAX_BOUNDS_PRECISION) === MAX_LATITUDE.toFixed(MAX_BOUNDS_PRECISION) && currentBounds._sw.lat.toFixed(MAX_BOUNDS_PRECISION) === MIN_LATITUDE.toFixed(MAX_BOUNDS_PRECISION) || currentBounds._ne.lng.toFixed(MAX_BOUNDS_PRECISION) === MAX_LONGITUDE.toFixed(MAX_BOUNDS_PRECISION) && currentBounds._sw.lng.toFixed(MAX_BOUNDS_PRECISION) === MIN_LONGITUDE.toFixed(MAX_BOUNDS_PRECISION);
|
|
14
|
+
}
|
|
15
|
+
function generateNewZoomState(event, initialViewState, zoomToFitInProgress) {
|
|
16
|
+
const map = event.target;
|
|
17
|
+
const viewState = event.viewState;
|
|
18
|
+
const currentBBox = map?.getBounds();
|
|
19
|
+
const zoomState = {};
|
|
20
|
+
if (event.type === "zoomend") {
|
|
21
|
+
zoomState.zoomInEnabled = map?.getMaxZoom() !== map?.getZoom();
|
|
22
|
+
zoomState.zoomOutEnabled = !isMinZoomReached(currentBBox);
|
|
23
|
+
}
|
|
24
|
+
if (zoomToFitInProgress) {
|
|
25
|
+
zoomState.zoomToFitEnabled = false;
|
|
26
|
+
zoomState.zoomToFitInProgress = false;
|
|
27
|
+
} else {
|
|
28
|
+
zoomState.zoomToFitEnabled = true;
|
|
29
|
+
}
|
|
30
|
+
zoomState.resetEnabled = !compareViewStates(viewState, initialViewState);
|
|
31
|
+
return zoomState;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
generateNewZoomState
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=zoom-state-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/map/components/toolbar/utils/zoom-state-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n LngLatBounds,\n type ViewState,\n type ViewStateChangeEvent,\n} from '@vis.gl/react-maplibre';\n\nimport {\n MAX_BOUNDS_PRECISION,\n MAX_LATITUDE,\n MAX_LONGITUDE,\n MIN_LATITUDE,\n MIN_LONGITUDE,\n VIEW_STATE_PRECISION,\n} from '../../../constants.js';\nimport type { ViewStateRequired } from '../../../types/map-view.js';\nimport type { ZoomState } from '../../../types/state.js';\n\nfunction compareViewStates(\n currentViewState: ViewState,\n initialViewState: ViewStateRequired,\n): boolean {\n return (\n currentViewState.zoom.toFixed(VIEW_STATE_PRECISION) ===\n initialViewState.zoom.toFixed(VIEW_STATE_PRECISION) &&\n currentViewState.latitude.toFixed(VIEW_STATE_PRECISION) ===\n initialViewState.latitude.toFixed(VIEW_STATE_PRECISION) &&\n currentViewState.longitude.toFixed(VIEW_STATE_PRECISION) ===\n initialViewState.longitude.toFixed(VIEW_STATE_PRECISION)\n );\n}\n\nfunction isMinZoomReached(currentBounds: LngLatBounds): boolean {\n return (\n (currentBounds._ne.lat.toFixed(MAX_BOUNDS_PRECISION) ===\n MAX_LATITUDE.toFixed(MAX_BOUNDS_PRECISION) &&\n currentBounds._sw.lat.toFixed(MAX_BOUNDS_PRECISION) ===\n MIN_LATITUDE.toFixed(MAX_BOUNDS_PRECISION)) ||\n (currentBounds._ne.lng.toFixed(MAX_BOUNDS_PRECISION) ===\n MAX_LONGITUDE.toFixed(MAX_BOUNDS_PRECISION) &&\n currentBounds._sw.lng.toFixed(MAX_BOUNDS_PRECISION) ===\n MIN_LONGITUDE.toFixed(MAX_BOUNDS_PRECISION))\n );\n}\n\nexport function generateNewZoomState(\n event: ViewStateChangeEvent,\n initialViewState: ViewStateRequired,\n zoomToFitInProgress?: boolean,\n): Partial<ZoomState> {\n const map = event.target;\n const viewState = event.viewState;\n const currentBBox = map?.getBounds();\n const zoomState: Partial<ZoomState> = {};\n\n if (event.type === 'zoomend') {\n zoomState.zoomInEnabled = map?.getMaxZoom() !== map?.getZoom();\n zoomState.zoomOutEnabled = !isMinZoomReached(currentBBox);\n }\n\n if (zoomToFitInProgress) {\n zoomState.zoomToFitEnabled = false;\n zoomState.zoomToFitInProgress = false;\n } else {\n zoomState.zoomToFitEnabled = true;\n }\n\n zoomState.resetEnabled = !compareViewStates(viewState, initialViewState);\n\n return zoomState;\n}\n"],
|
|
5
|
+
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,kBACP,kBACA,kBACS;AACT,SACE,iBAAiB,KAAK,QAAQ,oBAAoB,MAChD,iBAAiB,KAAK,QAAQ,oBAAoB,KACpD,iBAAiB,SAAS,QAAQ,oBAAoB,MACpD,iBAAiB,SAAS,QAAQ,oBAAoB,KACxD,iBAAiB,UAAU,QAAQ,oBAAoB,MACrD,iBAAiB,UAAU,QAAQ,oBAAoB;AAE7D;AAEA,SAAS,iBAAiB,eAAsC;AAC9D,SACG,cAAc,IAAI,IAAI,QAAQ,oBAAoB,MACjD,aAAa,QAAQ,oBAAoB,KACzC,cAAc,IAAI,IAAI,QAAQ,oBAAoB,MAChD,aAAa,QAAQ,oBAAoB,KAC5C,cAAc,IAAI,IAAI,QAAQ,oBAAoB,MACjD,cAAc,QAAQ,oBAAoB,KAC1C,cAAc,IAAI,IAAI,QAAQ,oBAAoB,MAChD,cAAc,QAAQ,oBAAoB;AAElD;AAEO,SAAS,qBACd,OACA,kBACA,qBACoB;AACpB,QAAM,MAAM,MAAM;AAClB,QAAM,YAAY,MAAM;AACxB,QAAM,cAAc,KAAK,UAAU;AACnC,QAAM,YAAgC,CAAC;AAEvC,MAAI,MAAM,SAAS,WAAW;AAC5B,cAAU,gBAAgB,KAAK,WAAW,MAAM,KAAK,QAAQ;AAC7D,cAAU,iBAAiB,CAAC,iBAAiB,WAAW;AAAA,EAC1D;AAEA,MAAI,qBAAqB;AACvB,cAAU,mBAAmB;AAC7B,cAAU,sBAAsB;AAAA,EAClC,OAAO;AACL,cAAU,mBAAmB;AAAA,EAC/B;AAEA,YAAU,eAAe,CAAC,kBAAkB,WAAW,gBAAgB;AAEvE,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/map/constants.js
CHANGED
|
@@ -86,6 +86,9 @@ const DEFAULT_BASE_LAYER_RULES = {
|
|
|
86
86
|
include: [INCLUDE_ALL_WILDCARD_RULE],
|
|
87
87
|
exclude: []
|
|
88
88
|
};
|
|
89
|
+
const BOUNDING_BOX_PRECISION = 6;
|
|
90
|
+
const VIEW_STATE_PRECISION = 4;
|
|
91
|
+
const MAX_BOUNDS_PRECISION = 2;
|
|
89
92
|
export {
|
|
90
93
|
ACTIVE_BORDER_WIDTH_INNER,
|
|
91
94
|
ACTIVE_BORDER_WIDTH_OUTER,
|
|
@@ -93,6 +96,7 @@ export {
|
|
|
93
96
|
BASE_LAYER_FILL_ID,
|
|
94
97
|
BASE_LAYER_IDS,
|
|
95
98
|
BASE_LAYER_LINE_ID,
|
|
99
|
+
BOUNDING_BOX_PRECISION,
|
|
96
100
|
BUBBLE_DEFAULT_OPACITY,
|
|
97
101
|
BUBBLE_OUTLINE_STROKE,
|
|
98
102
|
BUBBLE_STROKE,
|
|
@@ -134,6 +138,7 @@ export {
|
|
|
134
138
|
ICON_BACKGROUND_OPACITY,
|
|
135
139
|
ICON_BACKGROUND_RADIUS,
|
|
136
140
|
INCLUDE_ALL_WILDCARD_RULE,
|
|
141
|
+
MAX_BOUNDS_PRECISION,
|
|
137
142
|
MAX_LATITUDE,
|
|
138
143
|
MAX_LINE_THICKNESS,
|
|
139
144
|
MAX_LONGITUDE,
|
|
@@ -144,6 +149,7 @@ export {
|
|
|
144
149
|
SHAPE_OPACITY_DEFAULT,
|
|
145
150
|
SHAPE_OPACITY_DIMMED,
|
|
146
151
|
TRANSPARENT_BORDER_COLOR,
|
|
152
|
+
VIEW_STATE_PRECISION,
|
|
147
153
|
WORLD_VIEW_MAX_BOUNDARIES
|
|
148
154
|
};
|
|
149
155
|
//# sourceMappingURL=constants.js.map
|
package/esm/map/constants.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/map/constants.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ExpressionSpecification } from '@maplibre/maplibre-gl-style-spec';\nimport { defineMessages } from 'react-intl';\n\nimport type { _TruncationMode as TruncationMode } from '@dynatrace/strato-components/typography';\nimport Colors from '@dynatrace/strato-design-tokens/colors';\n\nimport type { BaseLayerRules } from './types/base-layer.js';\n\n//region GENERAL\nexport const DEFAULT_COUNTRIES_FILL_COLOR =\n Colors.Background.Container.Neutral.Default;\nexport const DEFAULT_BOUNDARIES_BORDER_COLOR = Colors.Border.Neutral.Default;\nexport const COUNTRY_BORDER_WIDTH = 1;\nexport const REGION_BORDER_WIDTH = 0.4;\nexport const TRANSPARENT_BORDER_COLOR = '#00000000';\n\n// region Map max bounds:\n// These bounds hide the space used by Antarctica and some portion of the North Pole\nexport const MAX_LATITUDE = 85;\nexport const MIN_LATITUDE = -60;\nexport const MAX_LONGITUDE = 179.99;\nexport const MIN_LONGITUDE = -179.99;\n// endregion\n\nexport const WORLD_VIEW_MAX_BOUNDARIES:
|
|
5
|
-
"mappings": "AACA,SAAS,sBAAsB;AAG/B,OAAO,YAAY;
|
|
4
|
+
"sourcesContent": ["import type { ExpressionSpecification } from '@maplibre/maplibre-gl-style-spec';\nimport { defineMessages } from 'react-intl';\n\nimport type { _TruncationMode as TruncationMode } from '@dynatrace/strato-components/typography';\nimport Colors from '@dynatrace/strato-design-tokens/colors';\n\nimport type { BaseLayerRules } from './types/base-layer.js';\nimport type { BoundingBoxCoords } from './types/map-view.js';\n\n//region GENERAL\nexport const DEFAULT_COUNTRIES_FILL_COLOR =\n Colors.Background.Container.Neutral.Default;\nexport const DEFAULT_BOUNDARIES_BORDER_COLOR = Colors.Border.Neutral.Default;\nexport const COUNTRY_BORDER_WIDTH = 1;\nexport const REGION_BORDER_WIDTH = 0.4;\nexport const TRANSPARENT_BORDER_COLOR = '#00000000';\n\n// region Map max bounds:\n// These bounds hide the space used by Antarctica and some portion of the North Pole\nexport const MAX_LATITUDE = 85;\nexport const MIN_LATITUDE = -60;\nexport const MAX_LONGITUDE = 179.99;\nexport const MIN_LONGITUDE = -179.99;\n// endregion\n\nexport const WORLD_VIEW_MAX_BOUNDARIES: BoundingBoxCoords = [\n MAX_LONGITUDE,\n MAX_LATITUDE,\n MIN_LONGITUDE,\n MIN_LATITUDE,\n];\nexport const DEFAULT_COUNTRY_CODE = 'default';\nexport const FIT_BOUNDS_OPTIONS = { padding: 20 };\nexport const DEFAULT_MAP_HEIGHT = 400;\nexport const DEFAULT_MAP_LEGEND_RATIO = 'auto';\nexport const DEFAULT_MAP_POSITION = 'auto';\nexport const DEFAULT_INPUT_ICON_SIZE = 20;\nexport const ACTIVE_COLOR = Colors.Border.Neutral.Accent;\n\nexport const BASE_LAYER_FILL_ID = 'geojson-fill';\nexport const BASE_LAYER_LINE_ID = 'geojson-line';\nexport const BASE_LAYER_IDS = [BASE_LAYER_LINE_ID, BASE_LAYER_FILL_ID];\nexport const SHAPE_OPACITY_DEFAULT = 1;\nexport const SHAPE_OPACITY_DIMMED = 0.2;\n\nexport const DEFAULT_SYMBOL_SIZE = 32;\nexport const FALLBACK_SYMBOL_SIZE = 1;\nexport const DEFAULT_TRUNCATION_MODE = 'middle' as TruncationMode;\n\nexport const CDN_BASE_PATH =\n 'https://dt-cdn.net/scripts/data/worldmap/maps/v004/' as const;\nexport const INCLUDE_ALL_WILDCARD_RULE = '*' as const;\n//endregion\n\n//region LEGEND\nexport const DEFAULT_BASIC_SHAPE_COLOR_TOKEN =\n Colors.Charts.CategoricalThemed.PurpleRain.Color01;\nexport const DEFAULT_LEGEND_SIZES = {\n // Minimum size in which the legend can be resized (vertical layout)\n minWidth: 0.1,\n // Minimum size in which the legend can be resized (horizontal layout)\n minHeight: 0.1,\n // Maximum size in which the legend can be resized (vertical layout). 80% represent 4 / 5ths of the container.\n maxWidth: 0.8,\n // Maximum size in which the legend can be resized (horizontal layout). 80% represent 4 / 5ths of the container.\n maxHeight: 0.8,\n};\nexport const DEFAULT_FORMATTER = {\n maximumFractionDigits: 1,\n};\nexport const DEFAULT_RANGE_COLOR = Colors.Background.Container.Neutral.Accent;\nexport const DEFAULT_SEQUENTIAL_LEGEND_COLOR_PALETTE = 'blue';\n//endregion\n\n//region DOT LAYER\nexport const ICON_BACKGROUND_OPACITY = 0.7;\nexport const ICON_BACKGROUND_RADIUS = 16;\nexport const DEFAULT_ICON_BACKGROUND_COLOR =\n Colors.Background.Container.Neutral.Subdued;\nexport const DEFAULT_ICON_SIZE_RATIO = 0.6;\nexport const DEFAULT_SHAPE_COLOR = Colors.Charts.Categorical.Color15.Default;\nexport const DEFAULT_ICON_COLOR = Colors.Icon.Neutral.Default;\n//endregion\n\n//region BUBBLE LAYER\nexport const DEFAULT_BUBBLE_COLOR = Colors.Charts.Categorical.Color07.Default;\nexport const DEFAULT_RADIUS = 12;\nexport const BUBBLE_DEFAULT_OPACITY = 0.4;\nexport const BUBBLE_STROKE = 1;\nexport const BUBBLE_OUTLINE_STROKE = 1;\nexport const DEFAULT_RADIUS_EXPRESSION: ExpressionSpecification = [\n 'get',\n '__radius',\n];\n//endregion\n\n//region CONNECTION LAYER\nexport const DEFAULT_LINE_JOIN: 'bevel' | 'round' | 'miter' = 'miter';\nexport const DEFAULT_LINE_CAP: 'butt' | 'round' | 'square' = 'butt';\nexport const DEFAULT_LINE_THICKNESS = 2;\nexport const DEFAULT_LINE_COLOR = Colors.Charts.Categorical.Color03.Default;\nexport const DEFAULT_LINE_DASH_ARRAY = [5, 2.5];\nexport const MIN_LINE_THICKNESS = 1;\nexport const MAX_LINE_THICKNESS = 64;\nexport const DIRECTION_ICON_OUTPUT_SIZE = 128;\nexport const DIRECTION_ICON_SHRINK_RATIO = 1 / 15;\n//endregion\n\n//region CHOROPLETH LAYER\nexport const ACTIVE_BORDER_WIDTH_OUTER = 3;\nexport const ACTIVE_BORDER_WIDTH_INNER = 1;\n\nexport const DEFAULT_CHOROPLETH_COLOR =\n Colors.Charts.Sequential.Blue.Color05.Default;\n\nexport const COPY_TO_CLIPBOARD_MESSAGES = defineMessages({\n copyActionCoords: {\n id: 'g2qESM+ibB5sUyjf',\n defaultMessage: 'Copy coordinates',\n description:\n 'Text in a tooltip shown when hovering a tooltip item and hovering the copy button next to its coordinates',\n },\n});\n//endregion\n\n//region BASE LAYER RULES\nexport const DEFAULT_BASE_LAYER_RULES = {\n include: [INCLUDE_ALL_WILDCARD_RULE],\n exclude: [],\n} as const as BaseLayerRules;\n\n//endregion\n\n//region Zoom state comparison precision\nexport const BOUNDING_BOX_PRECISION = 6;\nexport const VIEW_STATE_PRECISION = 4;\nexport const MAX_BOUNDS_PRECISION = 2;\n//endregion\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,sBAAsB;AAG/B,OAAO,YAAY;AAMZ,MAAM,+BACX,OAAO,WAAW,UAAU,QAAQ;AAC/B,MAAM,kCAAkC,OAAO,OAAO,QAAQ;AAC9D,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,2BAA2B;AAIjC,MAAM,eAAe;AACrB,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AAGtB,MAAM,4BAA+C;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB,EAAE,SAAS,GAAG;AACzC,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,eAAe,OAAO,OAAO,QAAQ;AAE3C,MAAM,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;AAAA,EACvD,kBAAkB;AAAA,IAChB,IAAI;AAAA,IACJ,gBAAgB;AAAA,IAChB,aACE;AAAA,EACJ;AACF,CAAC;AAIM,MAAM,2BAA2B;AAAA,EACtC,SAAS,CAAC,yBAAyB;AAAA,EACnC,SAAS,CAAC;AACZ;AAKO,MAAM,yBAAyB;AAC/B,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { WORLD_VIEW_MAX_BOUNDARIES } from "../constants.js";
|
|
3
|
-
const MapDataBoundingBoxContext = React.createContext(
|
|
3
|
+
const MapDataBoundingBoxContext = React.createContext(
|
|
4
|
+
WORLD_VIEW_MAX_BOUNDARIES
|
|
5
|
+
);
|
|
4
6
|
export {
|
|
5
7
|
MapDataBoundingBoxContext
|
|
6
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/map/contexts/map-data-bounding-box.context.ts"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\n\nimport { WORLD_VIEW_MAX_BOUNDARIES } from '../constants.js';\n\nexport const MapDataBoundingBoxContext = React.createContext
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,iCAAiC;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\n\nimport { WORLD_VIEW_MAX_BOUNDARIES } from '../constants.js';\nimport type { BoundingBoxCoords } from '../types/map-view.js';\n\nexport const MapDataBoundingBoxContext = React.createContext<BoundingBoxCoords>(\n WORLD_VIEW_MAX_BOUNDARIES,\n);\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAElB,SAAS,iCAAiC;AAGnC,MAAM,4BAA4B,MAAM;AAAA,EAC7C;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|