@rio-cloud/rio-uikit 2.3.0-beta.3 → 2.4.0
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/MapPreviousViewportButton.d.ts +2 -0
- package/MapPreviousViewportButton.js +5 -0
- package/MapPreviousViewportButton.js.map +1 -0
- package/Table.js +16 -14
- package/TableNext.js +16 -14
- package/TableRowActionsDropdown.d.ts +2 -0
- package/TableRowActionsDropdown.js +5 -0
- package/TableRowActionsDropdown.js.map +1 -0
- package/components/dropdown/ButtonDropdown.d.ts +4 -0
- package/components/dropdown/ButtonDropdown.js +82 -80
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/map/components/Map.js +219 -182
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/MapContext.d.ts +4 -0
- package/components/map/components/MapContext.js +11 -7
- package/components/map/components/MapContext.js.map +1 -1
- package/components/map/components/MapPosition.d.ts +1 -1
- package/components/map/components/MapPosition.js +20 -13
- package/components/map/components/MapPosition.js.map +1 -1
- package/components/map/components/features/MapZoom.d.ts +0 -1
- package/components/map/components/features/MapZoom.js +12 -20
- package/components/map/components/features/MapZoom.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsTile.d.ts +27 -0
- package/components/map/components/features/settings/MapSettingsTile.js +17 -17
- package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.d.ts +10 -0
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.js +23 -0
- package/components/map/components/features/settings/buttons/MapPreviousViewportButton.js.map +1 -0
- package/components/map/hooks/useMapViewportHistory.d.ts +19 -0
- package/components/map/hooks/useMapViewportHistory.js +116 -0
- package/components/map/hooks/useMapViewportHistory.js.map +1 -0
- package/components/map/icons/MapIcon.d.ts +1 -0
- package/components/map/icons/MapIcon.js +46 -37
- package/components/map/icons/MapIcon.js.map +1 -1
- package/components/map/utils/mapTypes.d.ts +12 -0
- package/components/map/utils/mapTypes.js.map +1 -1
- package/components/map/utils/mapUtils.d.ts +2 -0
- package/components/map/utils/mapUtils.js +4 -0
- package/components/map/utils/mapUtils.js.map +1 -1
- package/components/selects/Multiselect.d.ts +6 -0
- package/components/selects/Multiselect.js +85 -83
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/Select.d.ts +6 -0
- package/components/selects/Select.js +79 -71
- package/components/selects/Select.js.map +1 -1
- package/components/table/Table.d.ts +5 -1
- package/components/table/Table.js +234 -210
- package/components/table/Table.js.map +1 -1
- package/components/table/Table.types.d.ts +55 -0
- package/components/table/TableExpandAllGroupsButton.d.ts +25 -0
- package/components/table/TableExpandAllGroupsButton.js +27 -0
- package/components/table/TableExpandAllGroupsButton.js.map +1 -0
- package/components/table/TableExpandedRow.d.ts +4 -0
- package/components/table/TableExpandedRow.js +101 -84
- package/components/table/TableExpandedRow.js.map +1 -1
- package/components/table/TableExpanderButton.js +11 -11
- package/components/table/TableExpanderButton.js.map +1 -1
- package/components/table/TableGroupRow.d.ts +16 -2
- package/components/table/TableGroupRow.js +57 -22
- package/components/table/TableGroupRow.js.map +1 -1
- package/components/table/TableHeader.d.ts +1 -9
- package/components/table/TableHeader.js +82 -65
- package/components/table/TableHeader.js.map +1 -1
- package/components/table/TableRow.d.ts +7 -1
- package/components/table/TableRow.js +89 -72
- package/components/table/TableRow.js.map +1 -1
- package/components/table/TableRowActionsDropdown.d.ts +11 -0
- package/components/table/TableRowActionsDropdown.js +22 -0
- package/components/table/TableRowActionsDropdown.js.map +1 -0
- package/components/table/TableStickyRowButton.d.ts +25 -0
- package/components/table/TableStickyRowButton.js +32 -0
- package/components/table/TableStickyRowButton.js.map +1 -0
- package/components/table/TableToolbar.d.ts +24 -3
- package/components/table/TableToolbar.js +78 -37
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableViewToggles.js +5 -5
- package/components/table/TableViewToggles.js.map +1 -1
- package/components/table/context/TableInteractionContext.d.ts +3 -0
- package/components/table/context/TableInteractionContext.js.map +1 -1
- package/components/table/context/TableRenderConfigContext.d.ts +2 -1
- package/components/table/context/TableRenderConfigContext.js.map +1 -1
- package/components/table/context/TableRenderContext.d.ts +1 -0
- package/components/table/context/TableRenderContext.js.map +1 -1
- package/components/table/layout/useMeasuredColumnMaxWidths.js +52 -54
- package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -1
- package/components/table/layout/useTableLayout.d.ts +4 -1
- package/components/table/layout/useTableLayout.js +54 -48
- package/components/table/layout/useTableLayout.js.map +1 -1
- package/components/table/layout/useTableVirtualization.js +51 -56
- package/components/table/layout/useTableVirtualization.js.map +1 -1
- package/components/table/model/resolveResponsiveViewType.d.ts +2 -0
- package/components/table/model/resolveResponsiveViewType.js +27 -0
- package/components/table/model/resolveResponsiveViewType.js.map +1 -0
- package/components/table/render/header/TableHeaderCellContent.js +4 -4
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
- package/components/table/render/header/TableHeaderSelectionCell.d.ts +3 -0
- package/components/table/render/header/TableHeaderSelectionCell.js +25 -14
- package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -1
- package/components/table/runtime/useRenderDraftState.js +1 -0
- package/components/table/runtime/useRenderDraftState.js.map +1 -1
- package/components/table/runtime/useResponsiveResolvedViewType.d.ts +23 -0
- package/components/table/runtime/useResponsiveResolvedViewType.js +22 -0
- package/components/table/runtime/useResponsiveResolvedViewType.js.map +1 -0
- package/components/table/selection/useInternalTableSelectionState.d.ts +2 -0
- package/components/table/selection/useInternalTableSelectionState.js +29 -17
- package/components/table/selection/useInternalTableSelectionState.js.map +1 -1
- package/components/table/selection/useTableSelection.d.ts +5 -1
- package/components/table/selection/useTableSelection.js +37 -26
- package/components/table/selection/useTableSelection.js.map +1 -1
- package/components/table/shared/parsePixelSize.d.ts +2 -0
- package/components/table/shared/parsePixelSize.js +13 -0
- package/components/table/shared/parsePixelSize.js.map +1 -0
- package/hooks/useResizeObserver.d.ts +25 -6
- package/hooks/useResizeObserver.js +20 -18
- package/hooks/useResizeObserver.js.map +1 -1
- package/package.json +10 -10
- package/version.d.ts +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
|
@@ -1,225 +1,262 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { isEmpty as
|
|
4
|
-
import { isEqual as
|
|
5
|
-
import { DEFAULT_MAX_ZOOM as
|
|
6
|
-
import { removeEventListenerMap as
|
|
7
|
-
import { MapContext as
|
|
8
|
-
import { getMapBounds as
|
|
9
|
-
import { getHereUi as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { getPlatform as
|
|
17
|
-
|
|
1
|
+
import { jsx as p, jsxs as He } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S, useState as i, useMemo as Ue, useEffect as l } from "react";
|
|
3
|
+
import { isEmpty as ze } from "es-toolkit/compat";
|
|
4
|
+
import { isEqual as Ve } from "es-toolkit/predicate";
|
|
5
|
+
import { DEFAULT_MAX_ZOOM as ce, MAP_TYPE_DEFAULT as w, DEFAULT_PIXEL_RATIO as je, DEFAULT_MIN_ZOOM as We, MAP_LAYER_ROAD_RESTRICTIONS as pe, MAP_TYPE_NIGHT as V, MAP_TYPE_FLEET_STYLE as qe, MAP_TYPE_SATELLITE as Ge, MAP_TYPE_TERRAIN as Ke, MAP_LAYER_INCIDENTS as Xe, MAP_LAYER_TRAFFIC as $e } from "./constants.js";
|
|
6
|
+
import { removeEventListenerMap as Je, addEventListenerMap as Qe } from "../utils/eventHandling.js";
|
|
7
|
+
import { MapContext as et } from "./MapContext.js";
|
|
8
|
+
import { getMapBounds as tt, createUtils as ot } from "../utils/mapUtils.js";
|
|
9
|
+
import { getHereUi as nt } from "../utils/mapUi.js";
|
|
10
|
+
import rt from "../../../hooks/useDarkMode.js";
|
|
11
|
+
import at from "./features/MapZoom.js";
|
|
12
|
+
import st from "./features/layers/MapOverlayLayers.js";
|
|
13
|
+
import it from "./MapSize.js";
|
|
14
|
+
import lt from "./MapPosition.js";
|
|
15
|
+
import mt from "./MapElements.js";
|
|
16
|
+
import { getPlatform as ct, getBaseLayer as pt, getEngineType as ut } from "../utils/rendering.js";
|
|
17
|
+
import { useMapViewportHistory as Et } from "../hooks/useMapViewportHistory.js";
|
|
18
|
+
const dt = "map-disable-marker-pointer-events", vt = 140, s = (ue) => {
|
|
18
19
|
const {
|
|
19
|
-
children:
|
|
20
|
-
credentials:
|
|
21
|
-
width:
|
|
22
|
-
height:
|
|
23
|
-
language:
|
|
24
|
-
center:
|
|
25
|
-
zoom:
|
|
26
|
-
zoomAnimation:
|
|
27
|
-
boundingBox:
|
|
28
|
-
hideClusterSettings:
|
|
29
|
-
hideMapLayerSettings:
|
|
30
|
-
disableMapEvents:
|
|
31
|
-
disableBehavior:
|
|
32
|
-
disableZoomMomentum:
|
|
20
|
+
children: Ee,
|
|
21
|
+
credentials: j,
|
|
22
|
+
width: W,
|
|
23
|
+
height: q,
|
|
24
|
+
language: de = "en",
|
|
25
|
+
center: m,
|
|
26
|
+
zoom: u,
|
|
27
|
+
zoomAnimation: b = !1,
|
|
28
|
+
boundingBox: O,
|
|
29
|
+
hideClusterSettings: ve = !1,
|
|
30
|
+
hideMapLayerSettings: fe = !1,
|
|
31
|
+
disableMapEvents: G,
|
|
32
|
+
disableBehavior: K = !1,
|
|
33
|
+
disableZoomMomentum: X = !0,
|
|
34
|
+
enableFractionalZoom: x = !1,
|
|
33
35
|
eventListenerMap: he,
|
|
34
|
-
mapType:
|
|
35
|
-
mapLayer:
|
|
36
|
-
showCluster:
|
|
37
|
-
showScaleBar:
|
|
38
|
-
onMapLayerChange:
|
|
36
|
+
mapType: g = w,
|
|
37
|
+
mapLayer: E = [],
|
|
38
|
+
showCluster: D = !0,
|
|
39
|
+
showScaleBar: Me = !1,
|
|
40
|
+
onMapLayerChange: Le = () => {
|
|
39
41
|
},
|
|
40
|
-
onMapTypeChange:
|
|
42
|
+
onMapTypeChange: Te = () => {
|
|
41
43
|
},
|
|
42
|
-
onShowClusterChange:
|
|
44
|
+
onShowClusterChange: ge = () => {
|
|
43
45
|
},
|
|
44
|
-
onZoomIn:
|
|
46
|
+
onZoomIn: _e = () => {
|
|
45
47
|
},
|
|
46
|
-
onZoomOut:
|
|
48
|
+
onZoomOut: Ae = () => {
|
|
47
49
|
},
|
|
48
|
-
onIncidentsChange:
|
|
50
|
+
onIncidentsChange: Re = () => {
|
|
49
51
|
},
|
|
50
|
-
mapSettingsTooltip:
|
|
51
|
-
mapSettings:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
mapSettingsTooltip: ye,
|
|
53
|
+
mapSettings: $,
|
|
54
|
+
maxViewportHistoryEntries: Pe,
|
|
55
|
+
enableWebGL: d = !0,
|
|
56
|
+
enableDevicePixelRatio: J = !0,
|
|
57
|
+
enableMarkerIconCache: Ce = !0,
|
|
58
|
+
disableMarkerPointerEventsWhileZooming: v = !1,
|
|
59
|
+
pixelRatio: Q = je,
|
|
60
|
+
minZoom: _ = We,
|
|
61
|
+
maxZoom: N = ce
|
|
62
|
+
} = ue;
|
|
63
|
+
let Y = N;
|
|
64
|
+
_ > N && (Y = ce, console.error("Invalid condition for zoom limits: min <= max)"));
|
|
65
|
+
const A = S(null), f = S(), ee = S(!1), Z = S(v), [Ie, Se] = i(!1), [we, R] = i(!1), [t, be] = i(), [r, Oe] = i(g), [a, te] = i(E), [oe, ne] = i(D), xe = Ue(
|
|
66
|
+
() => m && u !== void 0 ? { center: m, zoom: u } : void 0,
|
|
67
|
+
[m?.lat, m?.lng, u]
|
|
68
|
+
), De = Et(t, {
|
|
69
|
+
maxEntries: Pe,
|
|
70
|
+
zoomAnimation: b,
|
|
71
|
+
controlledViewport: xe
|
|
72
|
+
}), re = J && window.devicePixelRatio || Q, c = /* @__PURE__ */ ((e) => e === "nb" ? "no" : e)(de.split("-")[0].toLowerCase()), h = (e) => {
|
|
73
|
+
if (e && !Z.current)
|
|
64
74
|
return;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
}, ne = () => {
|
|
70
|
-
v(), d.current = window.setTimeout(() => {
|
|
71
|
-
h(!1), d.current = void 0;
|
|
72
|
-
}, lt);
|
|
75
|
+
const n = A.current;
|
|
76
|
+
n && (n.classList.toggle(dt, e), ee.current = e);
|
|
77
|
+
}, M = () => {
|
|
78
|
+
f.current !== void 0 && (window.clearTimeout(f.current), f.current = void 0);
|
|
73
79
|
}, ae = () => {
|
|
74
|
-
|
|
80
|
+
M(), f.current = window.setTimeout(() => {
|
|
81
|
+
h(!1), R(!1), f.current = void 0;
|
|
82
|
+
}, vt);
|
|
83
|
+
}, se = () => {
|
|
84
|
+
R(!0), M(), Z.current && !ee.current && h(!0);
|
|
75
85
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
|
|
86
|
+
l(() => {
|
|
87
|
+
Z.current = v;
|
|
88
|
+
}, [v]), l(() => {
|
|
89
|
+
const e = A.current;
|
|
90
|
+
if (!e)
|
|
91
|
+
return;
|
|
92
|
+
const n = () => {
|
|
93
|
+
se(), ae();
|
|
94
|
+
};
|
|
95
|
+
return e.addEventListener("wheel", n, { passive: !0, capture: !0 }), () => {
|
|
96
|
+
e.removeEventListener("wheel", n, { capture: !0 });
|
|
80
97
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
}, []), l(() => {
|
|
99
|
+
let e = [], n = () => {
|
|
100
|
+
};
|
|
101
|
+
t?.map ? (e = t.map.getObjects(), console.debug("re-initialize here map")) : console.debug("initialize here map"), t?.map && (console.debug("disposing previous map"), Je(t.map), t.mapEvents && t.mapEvents.dispose(), t.map.dispose());
|
|
102
|
+
const C = O && tt(O), L = ct(j), T = ut(r, d), k = L.createDefaultLayers({ engineType: T, lg: c, pois: !0 });
|
|
103
|
+
return pt({
|
|
104
|
+
baseLayerName: r,
|
|
105
|
+
defaultLayers: k,
|
|
106
|
+
enableWebGL: d,
|
|
107
|
+
platform: L,
|
|
108
|
+
engineType: T,
|
|
109
|
+
vehicleRestrictions: a.includes(pe),
|
|
110
|
+
language: c,
|
|
111
|
+
minZoom: _,
|
|
112
|
+
maxZoom: Y
|
|
113
|
+
}).then((U) => {
|
|
114
|
+
const le = () => {
|
|
115
|
+
se();
|
|
116
|
+
}, me = () => {
|
|
95
117
|
ae();
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
engineType: f,
|
|
103
|
-
pixelRatio: te,
|
|
118
|
+
}, o = new H.Map(A.current, U.baseLayer, {
|
|
119
|
+
zoom: u,
|
|
120
|
+
center: m,
|
|
121
|
+
bounds: C,
|
|
122
|
+
engineType: T,
|
|
123
|
+
pixelRatio: re,
|
|
104
124
|
fixedCenter: !0
|
|
105
125
|
});
|
|
106
|
-
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
credentials:
|
|
112
|
-
defaultLayers:
|
|
113
|
-
map:
|
|
114
|
-
mapEvents:
|
|
115
|
-
behavior:
|
|
116
|
-
platform:
|
|
117
|
-
ui:
|
|
118
|
-
utils:
|
|
126
|
+
U.overlayLayer && o.addLayer(U.overlayLayer), Se(!0);
|
|
127
|
+
let z = !1, I;
|
|
128
|
+
G || (z = new H.mapevents.MapEvents(o)), G || K || (I = new H.mapevents.Behavior(z), x || I.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM), X && I.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM)), Qe(o, he, o), o.addEventListener("mapviewchangestart", le), o.addEventListener("mapviewchangeend", me);
|
|
129
|
+
const ke = nt(o, k, Me, c);
|
|
130
|
+
be({
|
|
131
|
+
credentials: j,
|
|
132
|
+
defaultLayers: k,
|
|
133
|
+
map: o,
|
|
134
|
+
mapEvents: z,
|
|
135
|
+
behavior: I,
|
|
136
|
+
platform: L,
|
|
137
|
+
ui: ke,
|
|
138
|
+
utils: ot(o),
|
|
119
139
|
// Put settings back into the map API object so the invoking service
|
|
120
140
|
// can check on these settings for instance inside a test
|
|
121
141
|
settings: {
|
|
122
|
-
enableWebGL:
|
|
123
|
-
baseLayer:
|
|
124
|
-
activeLayers:
|
|
125
|
-
showCluster:
|
|
126
|
-
minZoom:
|
|
127
|
-
maxZoom:
|
|
142
|
+
enableWebGL: d,
|
|
143
|
+
baseLayer: r,
|
|
144
|
+
activeLayers: a,
|
|
145
|
+
showCluster: oe,
|
|
146
|
+
minZoom: _,
|
|
147
|
+
maxZoom: Y
|
|
128
148
|
}
|
|
129
|
-
}), e &&
|
|
130
|
-
|
|
149
|
+
}), e && o.addObjects(e), n = () => {
|
|
150
|
+
o.removeEventListener("mapviewchangestart", le), o.removeEventListener("mapviewchangeend", me);
|
|
131
151
|
};
|
|
132
152
|
}), () => {
|
|
133
|
-
|
|
153
|
+
n(), M(), h(!1), R(!1);
|
|
134
154
|
};
|
|
135
|
-
}, [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
}, [
|
|
156
|
+
d,
|
|
157
|
+
J,
|
|
158
|
+
c,
|
|
159
|
+
r,
|
|
160
|
+
_,
|
|
161
|
+
N,
|
|
162
|
+
X,
|
|
163
|
+
x
|
|
164
|
+
]), l(() => (v || (M(), h(!1)), () => {
|
|
165
|
+
M(), h(!1), R(!1);
|
|
166
|
+
}), [v]);
|
|
167
|
+
const F = rt();
|
|
168
|
+
l(() => {
|
|
169
|
+
F && r === w ? y(V) : !F && r === V && y(w);
|
|
170
|
+
}, [F, c]), l(() => y(g), [g]);
|
|
171
|
+
const [Ne, Ye] = i(E);
|
|
172
|
+
Ve(E, Ne) || (te(E), Ye(E)), l(() => ne(D), [D]);
|
|
173
|
+
const y = (e) => {
|
|
174
|
+
Oe(e), Te(e, g);
|
|
175
|
+
}, Ze = (e) => {
|
|
176
|
+
const n = (L) => a.filter((T) => T !== L), C = a.includes(e) ? n(e) : [...a, e];
|
|
177
|
+
te(C), Le(C, a);
|
|
178
|
+
}, Fe = (e) => {
|
|
179
|
+
ne(e), ge(e);
|
|
180
|
+
}, ie = () => {
|
|
152
181
|
document.querySelector(".AssetTree")?.classList.add("pointer-events-none");
|
|
153
|
-
},
|
|
182
|
+
}, B = () => {
|
|
154
183
|
document.querySelector(".AssetTree")?.classList.remove("pointer-events-none");
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
return /* @__PURE__ */ l(
|
|
184
|
+
}, P = {};
|
|
185
|
+
q && (P.height = q), W && (P.width = W);
|
|
186
|
+
const Be = ze(P) ? "height-100pct" : "";
|
|
187
|
+
return /* @__PURE__ */ p(
|
|
161
188
|
"div",
|
|
162
189
|
{
|
|
163
|
-
className: `Map position-relative map-type-${
|
|
164
|
-
style:
|
|
165
|
-
ref:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
Ge.Provider,
|
|
190
|
+
className: `Map position-relative map-type-${r.toLowerCase()} ${Be}`,
|
|
191
|
+
style: P,
|
|
192
|
+
ref: A,
|
|
193
|
+
onTouchStart: ie,
|
|
194
|
+
onTouchEnd: B,
|
|
195
|
+
onMouseEnter: ie,
|
|
196
|
+
onMouseOut: B,
|
|
197
|
+
onBlur: B,
|
|
198
|
+
children: Ie && t && /* @__PURE__ */ He(
|
|
199
|
+
et.Provider,
|
|
174
200
|
{
|
|
175
201
|
value: {
|
|
176
202
|
api: t,
|
|
177
|
-
language:
|
|
178
|
-
enableWebGL:
|
|
179
|
-
enableMarkerIconCache:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
203
|
+
language: c,
|
|
204
|
+
enableWebGL: d,
|
|
205
|
+
enableMarkerIconCache: Ce,
|
|
206
|
+
enableFractionalZoom: x,
|
|
207
|
+
isZoomInteractionActive: we,
|
|
208
|
+
showCluster: oe,
|
|
209
|
+
activeLayers: a,
|
|
210
|
+
baseLayer: r,
|
|
211
|
+
hideMapLayerSettings: fe,
|
|
212
|
+
hideClusterSettings: ve,
|
|
213
|
+
viewportHistory: De,
|
|
214
|
+
onMapTypeChange: y,
|
|
215
|
+
onMapLayerChange: Ze,
|
|
216
|
+
onShowClusterChange: Fe,
|
|
217
|
+
mapSettingsTooltip: ye,
|
|
218
|
+
onIncidentsChange: Re,
|
|
219
|
+
devicePixelRatio: re
|
|
191
220
|
},
|
|
192
221
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
222
|
+
/* @__PURE__ */ p(
|
|
223
|
+
lt,
|
|
224
|
+
{
|
|
225
|
+
api: t,
|
|
226
|
+
boundingBox: O,
|
|
227
|
+
center: m,
|
|
228
|
+
zoom: u,
|
|
229
|
+
zoomAnimation: b
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
/* @__PURE__ */ p(it, { api: t }),
|
|
233
|
+
/* @__PURE__ */ p(
|
|
234
|
+
at,
|
|
197
235
|
{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
zoomAnimation: V
|
|
236
|
+
hideZoomButtons: K,
|
|
237
|
+
onZoomIn: _e,
|
|
238
|
+
onZoomOut: Ae,
|
|
239
|
+
zoomAnimation: b
|
|
203
240
|
}
|
|
204
241
|
),
|
|
205
|
-
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
242
|
+
$ && $,
|
|
243
|
+
/* @__PURE__ */ p(st, { layers: a }),
|
|
244
|
+
/* @__PURE__ */ p(mt, { api: t, children: Ee })
|
|
208
245
|
]
|
|
209
246
|
}
|
|
210
247
|
)
|
|
211
248
|
}
|
|
212
249
|
);
|
|
213
250
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
251
|
+
s.TYPE_DEFAULT = w;
|
|
252
|
+
s.TYPE_FLEET_STYLE = qe;
|
|
253
|
+
s.TYPE_SATELLITE = Ge;
|
|
254
|
+
s.TYPE_TERRAIN = Ke;
|
|
255
|
+
s.TYPE_NIGHT = V;
|
|
256
|
+
s.LAYER_INCIDENTS = Xe;
|
|
257
|
+
s.LAYER_TRAFFIC = $e;
|
|
258
|
+
s.LAYER_ROAD_RESTRICTIONS = pe;
|
|
222
259
|
export {
|
|
223
|
-
|
|
260
|
+
s as default
|
|
224
261
|
};
|
|
225
262
|
//# sourceMappingURL=Map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\n\nconst MARKER_POINTER_EVENTS_DISABLED_CLASS = 'map-disable-marker-pointer-events';\nconst MARKER_POINTER_EVENTS_RESET_DELAY_MS = 140;\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n enableMarkerIconCache = true,\n disableMarkerPointerEventsWhileZooming = false,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n const markerPointerEventsResetTimeoutRef = useRef<number | undefined>();\n const markerPointerEventsDisabledRef = useRef(false);\n const disableMarkerPointerEventsWhileZoomingRef = useRef(disableMarkerPointerEventsWhileZooming);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n const setMarkerPointerEventsDisabled = (disabled: boolean) => {\n if (disabled && !disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n mapElement.classList.toggle(MARKER_POINTER_EVENTS_DISABLED_CLASS, disabled);\n markerPointerEventsDisabledRef.current = disabled;\n };\n\n const clearMarkerPointerEventsResetTimeout = () => {\n if (markerPointerEventsResetTimeoutRef.current !== undefined) {\n window.clearTimeout(markerPointerEventsResetTimeoutRef.current);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }\n };\n\n const scheduleMarkerPointerEventsEnable = () => {\n clearMarkerPointerEventsResetTimeout();\n markerPointerEventsResetTimeoutRef.current = window.setTimeout(() => {\n setMarkerPointerEventsDisabled(false);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }, MARKER_POINTER_EVENTS_RESET_DELAY_MS);\n };\n\n const temporarilyDisableMarkerPointerEvents = () => {\n if (!disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n clearMarkerPointerEventsResetTimeout();\n\n if (!markerPointerEventsDisabledRef.current) {\n setMarkerPointerEventsDisabled(true);\n }\n };\n\n useEffect(() => {\n disableMarkerPointerEventsWhileZoomingRef.current = disableMarkerPointerEventsWhileZooming;\n }, [disableMarkerPointerEventsWhileZooming]);\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n let removeMapViewChangeListeners = () => {};\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n const handleMapViewChangeStart = () => {\n temporarilyDisableMarkerPointerEvents();\n };\n\n const handleMapViewChangeEnd = () => {\n scheduleMarkerPointerEventsEnable();\n };\n\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n hereMap.addEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.addEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n\n removeMapViewChangeListeners = () => {\n hereMap.removeEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.removeEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n };\n });\n\n return () => {\n removeMapViewChangeListeners();\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [enableWebGL, enableDevicePixelRatio, language, baseLayer, minZoom, maxZoom]);\n\n useEffect(() => {\n if (!disableMarkerPointerEventsWhileZooming) {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n }\n\n return () => {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n };\n }, [disableMarkerPointerEventsWhileZooming]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n const handleMapWheelCapture = () => {\n temporarilyDisableMarkerPointerEvents();\n scheduleMarkerPointerEventsEnable();\n };\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onWheelCapture={handleMapWheelCapture}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n enableMarkerIconCache,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition api={api} boundingBox={boundingBox} center={center} zoomAnimation={zoomAnimation} />\n <MapSize api={api} />\n <MapZoom\n zoom={zoom}\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["MARKER_POINTER_EVENTS_DISABLED_CLASS","MARKER_POINTER_EVENTS_RESET_DELAY_MS","Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","enableWebGL","enableDevicePixelRatio","enableMarkerIconCache","disableMarkerPointerEventsWhileZooming","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","markerPointerEventsResetTimeoutRef","markerPointerEventsDisabledRef","disableMarkerPointerEventsWhileZoomingRef","isMapInitialized","setMapInitialized","useState","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","devicePixelRatio","language","locale","setMarkerPointerEventsDisabled","disabled","mapElement","clearMarkerPointerEventsResetTimeout","scheduleMarkerPointerEventsEnable","temporarilyDisableMarkerPointerEvents","useEffect","allMapObjects","removeMapViewChangeListeners","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","handleMapViewChangeStart","handleMapViewChangeEnd","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","handleMapWheelCapture","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYPE_FLEET_STYLE","MAP_TYPE_SATELLITE","MAP_TYPE_TERRAIN","MAP_LAYER_INCIDENTS","MAP_LAYER_TRAFFIC"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAuC,qCACvCC,KAAuC,KAEvCC,IAAM,CAACC,OAAoB;AAC7B,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAUC,KAAO;AAAA,IACjB,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,aAAAC;AAAA,IACA,qBAAAC,KAAsB;AAAA,IACtB,sBAAAC,KAAuB;AAAA,IACvB,kBAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,qBAAAC,KAAsB;AAAA,IACtB,kBAAAC;AAAA,IACA,SAAAC,IAAUC;AAAA,IACV,UAAAC,IAAW,CAAA;AAAA,IACX,aAAaC,IAAsB;AAAA,IACnC,cAAAC,KAAe;AAAA,IACf,kBAAAC,KAAmB,MAAM;AAAA,IAAC;AAAA,IAC1B,iBAAAC,KAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,qBAAAC,KAAsB,MAAM;AAAA,IAAC;AAAA,IAC7B,UAAAC,KAAW,MAAM;AAAA,IAAC;AAAA,IAClB,WAAAC,KAAY,MAAM;AAAA,IAAC;AAAA,IACnB,mBAAAC,KAAoB,MAAM;AAAA,IAAC;AAAA,IAC3B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gBACA,iBAAiBM;AAAA,gBACjB,UAAAW;AAAA,gBACA,WAAAC;AAAA,gBACA,eAAAjB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEHoB,KAAeA;AAAA,YAChB,gBAAAkF,EAACM,IAAA,EAAiB,QAAQhE,EAAA,CAAc;AAAA,YACxC,gBAAA0D,EAACO,IAAA,EAAY,KAAArE,GAAW,UAAA/C,GAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACrC;AAAA,EAAA;AAIhB;AAEAF,EAAI,eAAekB;AACnBlB,EAAI,mBAAmBuH;AACvBvH,EAAI,iBAAiBwH;AACrBxH,EAAI,eAAeyH;AACnBzH,EAAI,aAAa4F;AAEjB5F,EAAI,kBAAkB0H;AACtB1H,EAAI,gBAAgB2H;AACpB3H,EAAI,0BAA0B8E;"}
|
|
1
|
+
{"version":3,"file":"Map.js","sources":["../../../../src/components/map/components/Map.tsx"],"sourcesContent":["import { useRef, useState, useEffect, useMemo, type CSSProperties } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport {\n MAP_TYPE_DEFAULT,\n MAP_TYPE_FLEET_STYLE,\n MAP_TYPE_SATELLITE,\n MAP_TYPE_TERRAIN,\n MAP_TYPE_NIGHT,\n MAP_LAYER_INCIDENTS,\n MAP_LAYER_TRAFFIC,\n MAP_LAYER_ROAD_RESTRICTIONS,\n DEFAULT_MIN_ZOOM,\n DEFAULT_MAX_ZOOM,\n DEFAULT_PIXEL_RATIO,\n} from './constants';\n\nimport { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';\nimport { MapContext } from './MapContext';\nimport { createUtils, getMapBounds } from '../utils/mapUtils';\nimport { getHereUi } from '../utils/mapUi';\nimport useDarkMode from '../../../hooks/useDarkMode';\nimport MapZoom from './features/MapZoom';\nimport MapOverlayLayers from './features/layers/MapOverlayLayers';\nimport MapSize from './MapSize';\nimport MapPosition from './MapPosition';\nimport MapElements from './MapElements';\nimport type { MapApi, MapLayer, MapProps, MapType } from '../utils/mapTypes';\nimport { getPlatform, getEngineType, getBaseLayer } from '../utils/rendering';\nimport { useMapViewportHistory } from '../hooks/useMapViewportHistory';\n\nconst MARKER_POINTER_EVENTS_DISABLED_CLASS = 'map-disable-marker-pointer-events';\nconst MARKER_POINTER_EVENTS_RESET_DELAY_MS = 140;\n\nconst Map = (props: MapProps) => {\n const {\n children,\n credentials,\n width,\n height,\n language: lang = 'en',\n center,\n zoom,\n zoomAnimation = false,\n boundingBox,\n hideClusterSettings = false,\n hideMapLayerSettings = false,\n disableMapEvents,\n disableBehavior = false,\n disableZoomMomentum = true,\n enableFractionalZoom = false,\n eventListenerMap,\n mapType = MAP_TYPE_DEFAULT,\n mapLayer = [],\n showCluster: externalShowCluster = true,\n showScaleBar = false,\n onMapLayerChange = () => {},\n onMapTypeChange = () => {},\n onShowClusterChange = () => {},\n onZoomIn = () => {},\n onZoomOut = () => {},\n onIncidentsChange = () => {},\n mapSettingsTooltip,\n mapSettings,\n maxViewportHistoryEntries,\n enableWebGL = true,\n enableDevicePixelRatio = true,\n enableMarkerIconCache = true,\n disableMarkerPointerEventsWhileZooming = false,\n pixelRatio = DEFAULT_PIXEL_RATIO,\n minZoom = DEFAULT_MIN_ZOOM,\n maxZoom = DEFAULT_MAX_ZOOM,\n } = props;\n\n let safeMaxZoom = maxZoom;\n\n if (minZoom > maxZoom) {\n // Avoid crashing the map for invalid zoom limits\n safeMaxZoom = DEFAULT_MAX_ZOOM;\n console.error('Invalid condition for zoom limits: min <= max)');\n }\n\n const mapRef = useRef<HTMLDivElement>(null);\n const markerPointerEventsResetTimeoutRef = useRef<number | undefined>();\n const markerPointerEventsDisabledRef = useRef(false);\n const disableMarkerPointerEventsWhileZoomingRef = useRef(disableMarkerPointerEventsWhileZooming);\n\n const [isMapInitialized, setMapInitialized] = useState(false);\n const [isZoomInteractionActive, setIsZoomInteractionActive] = useState(false);\n\n const [api, setApi] = useState<MapApi>();\n\n const [baseLayer, setBaseLayer] = useState<MapType>(mapType);\n const [activeLayers, setActiveLayers] = useState<MapLayer[]>(mapLayer);\n const [showCluster, setShowCluster] = useState(externalShowCluster);\n const controlledViewport = useMemo(\n () => (center && zoom !== undefined ? { center, zoom } : undefined),\n [center?.lat, center?.lng, zoom]\n );\n const viewportHistory = useMapViewportHistory(api, {\n maxEntries: maxViewportHistoryEntries,\n zoomAnimation,\n controlledViewport,\n });\n\n const devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || pixelRatio : pixelRatio;\n\n // Only short locale is supported by HERE Map\n const language = (locale => (locale === 'nb' ? 'no' : locale))(lang.split('-')[0].toLowerCase());\n\n const setMarkerPointerEventsDisabled = (disabled: boolean) => {\n if (disabled && !disableMarkerPointerEventsWhileZoomingRef.current) {\n return;\n }\n\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n mapElement.classList.toggle(MARKER_POINTER_EVENTS_DISABLED_CLASS, disabled);\n markerPointerEventsDisabledRef.current = disabled;\n };\n\n const clearMarkerPointerEventsResetTimeout = () => {\n if (markerPointerEventsResetTimeoutRef.current !== undefined) {\n window.clearTimeout(markerPointerEventsResetTimeoutRef.current);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }\n };\n\n const scheduleMarkerPointerEventsEnable = () => {\n clearMarkerPointerEventsResetTimeout();\n markerPointerEventsResetTimeoutRef.current = window.setTimeout(() => {\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n markerPointerEventsResetTimeoutRef.current = undefined;\n }, MARKER_POINTER_EVENTS_RESET_DELAY_MS);\n };\n\n const temporarilyDisableMarkerPointerEvents = () => {\n setIsZoomInteractionActive(true);\n\n clearMarkerPointerEventsResetTimeout();\n\n if (disableMarkerPointerEventsWhileZoomingRef.current && !markerPointerEventsDisabledRef.current) {\n setMarkerPointerEventsDisabled(true);\n }\n };\n\n useEffect(() => {\n disableMarkerPointerEventsWhileZoomingRef.current = disableMarkerPointerEventsWhileZooming;\n }, [disableMarkerPointerEventsWhileZooming]);\n\n useEffect(() => {\n const mapElement = mapRef.current;\n\n if (!mapElement) {\n return;\n }\n\n const handleWheel = () => {\n temporarilyDisableMarkerPointerEvents();\n scheduleMarkerPointerEventsEnable();\n };\n\n mapElement.addEventListener('wheel', handleWheel, { passive: true, capture: true });\n\n return () => {\n mapElement.removeEventListener('wheel', handleWheel, { capture: true });\n };\n }, []);\n\n useEffect(() => {\n let allMapObjects: H.map.Object[] = [];\n let removeMapViewChangeListeners = () => {};\n\n if (api?.map) {\n allMapObjects = api.map.getObjects();\n console.debug('re-initialize here map');\n } else {\n console.debug('initialize here map');\n }\n\n if (api?.map) {\n // Cleanup any previously initialized map before doing anything else\n console.debug('disposing previous map');\n removeEventListenerMap(api.map);\n\n if (api.mapEvents) {\n api.mapEvents.dispose();\n }\n\n api.map.dispose();\n }\n\n const bounds = boundingBox && getMapBounds(boundingBox);\n\n // Initialize communication with the platform\n const platform = getPlatform(credentials);\n\n // Specify engine type. In this example, we use HARP rendering engine, which is capable\n // of rendering vector data using the style configuration exported from the HERE Style Editor.\n // HARP engine is not the default engine, and it's not included in the mapsjs-core.js module.\n // To use this engine, you need to include mapsjs-harp.js file to your HTML page\n const engineType = getEngineType(baseLayer, enableWebGL);\n\n // Obtain the default map types from the platform object\n // @ts-expect-error-next-line: according to the Here docs, the engine type exists\n // see https://www.here.com/docs/bundle/maps-api-for-javascript-developer-guide/page/topics/harp-migrate.html\n const defaultLayers = platform.createDefaultLayers({ engineType, lg: language, pois: true });\n\n getBaseLayer({\n baseLayerName: baseLayer,\n defaultLayers,\n enableWebGL,\n platform,\n engineType,\n vehicleRestrictions: activeLayers.includes(MAP_LAYER_ROAD_RESTRICTIONS),\n language,\n minZoom,\n maxZoom: safeMaxZoom,\n }).then(defaultLayerMap => {\n const handleMapViewChangeStart = () => {\n temporarilyDisableMarkerPointerEvents();\n };\n\n const handleMapViewChangeEnd = () => {\n scheduleMarkerPointerEventsEnable();\n };\n\n // Initialize the map\n const hereMap = new H.Map(mapRef.current as Element, defaultLayerMap.baseLayer, {\n zoom,\n center,\n bounds,\n engineType,\n pixelRatio: devicePixelRatio,\n fixedCenter: true,\n });\n\n if (defaultLayerMap.overlayLayer) {\n // Special case for satellite map where we render street labels and road signs as well as additional pois as vector data\n // hereMap.setBaseLayer(defaultLayerMap.baseLayer);\n hereMap.addLayer(defaultLayerMap.overlayLayer);\n }\n\n setMapInitialized(true);\n\n let hereMapEvents: H.mapevents.MapEvents | false = false;\n let hereBehavior: H.mapevents.Behavior | undefined;\n\n if (!disableMapEvents) {\n // Enable the map event system\n hereMapEvents = new H.mapevents.MapEvents(hereMap);\n }\n\n if (!(disableMapEvents || disableBehavior)) {\n hereBehavior = new H.mapevents.Behavior(hereMapEvents as H.mapevents.MapEvents);\n if (!enableFractionalZoom) {\n // Fractional zoom feels less predictable with mouse wheels in some setups,\n // but keeping it enabled can noticeably improve trackpad zoom smoothness.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.FRACTIONAL_ZOOM);\n }\n\n if (disableZoomMomentum) {\n // Disable the inertia that occurs on WebGL maps when scrolling/zooming.\n // This resulted in a very high scroll sensitivity.\n // @ts-expect-error-next-line\n hereBehavior.disable(H.mapevents.Behavior.Feature.ZOOM_MOMENTUM);\n }\n }\n\n addEventListenerMap(hereMap, eventListenerMap, hereMap);\n hereMap.addEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.addEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n\n const hereUi = getHereUi(hereMap, defaultLayers, showScaleBar, language);\n\n // The api will be passed to services when using a render function.\n // This allows the service to access the map internals\n setApi({\n credentials,\n defaultLayers,\n map: hereMap,\n mapEvents: hereMapEvents,\n behavior: hereBehavior,\n platform,\n ui: hereUi,\n utils: createUtils(hereMap),\n // Put settings back into the map API object so the invoking service\n // can check on these settings for instance inside a test\n settings: {\n enableWebGL,\n baseLayer,\n activeLayers,\n showCluster,\n minZoom,\n maxZoom: safeMaxZoom,\n },\n });\n\n if (allMapObjects) {\n // If the base layer changed, re-add all previous objects again,\n // otherwise the map would be empty\n hereMap.addObjects(allMapObjects);\n }\n\n removeMapViewChangeListeners = () => {\n hereMap.removeEventListener('mapviewchangestart', handleMapViewChangeStart as EventListener);\n hereMap.removeEventListener('mapviewchangeend', handleMapViewChangeEnd as EventListener);\n };\n });\n\n return () => {\n removeMapViewChangeListeners();\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n };\n }, [\n enableWebGL,\n enableDevicePixelRatio,\n language,\n baseLayer,\n minZoom,\n maxZoom,\n disableZoomMomentum,\n enableFractionalZoom,\n ]);\n\n useEffect(() => {\n if (!disableMarkerPointerEventsWhileZooming) {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n }\n\n return () => {\n clearMarkerPointerEventsResetTimeout();\n setMarkerPointerEventsDisabled(false);\n setIsZoomInteractionActive(false);\n };\n }, [disableMarkerPointerEventsWhileZooming]);\n\n const isDarkMode = useDarkMode();\n useEffect(() => {\n // Toggle night map only if current map type is default\n if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {\n handleMapTypeChange(MAP_TYPE_NIGHT);\n }\n // Toggle back to default map only if current map type is night\n else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {\n handleMapTypeChange(MAP_TYPE_DEFAULT);\n }\n }, [isDarkMode, language]);\n\n // Update MapType from outside\n useEffect(() => handleMapTypeChange(mapType), [mapType]);\n\n // Update MapLayer from outside\n const [previousMapLayer, setPreviousMapLayer] = useState(mapLayer);\n if (!isEqual(mapLayer, previousMapLayer)) {\n setActiveLayers(mapLayer);\n setPreviousMapLayer(mapLayer);\n }\n\n // Update Cluster setting from outside\n useEffect(() => setShowCluster(externalShowCluster), [externalShowCluster]);\n\n const handleMapTypeChange = (newMapType: MapType) => {\n setBaseLayer(newMapType);\n onMapTypeChange(newMapType, mapType);\n };\n\n const handleMapLayerChange = (layer: MapLayer) => {\n const removeLayer = (layerToRemove: string) => activeLayers.filter(item => item !== layerToRemove);\n const newActiveLayers = activeLayers.includes(layer) ? removeLayer(layer) : [...activeLayers, layer];\n setActiveLayers(newActiveLayers);\n onMapLayerChange(newActiveLayers, activeLayers);\n };\n\n const handleShowClusterChange = (newShowCluster: boolean) => {\n setShowCluster(newShowCluster);\n onShowClusterChange(newShowCluster);\n };\n\n // Note: For performance reasons, we deactivate pointer events and hence CSS style recalculation for the\n // the body. Having for instance many assets in the tree causes a performance loss when clicking on the map\n // to move it and zoom in/out since the map triggers a style invalidation and recalculation and\n // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors\n // takes time.\n const handleMapInteractionStart = () => {\n document.querySelector('.AssetTree')?.classList.add('pointer-events-none');\n };\n const handleMapInteractionEnd = () => {\n document.querySelector('.AssetTree')?.classList.remove('pointer-events-none');\n };\n\n const style: CSSProperties = {};\n if (height) {\n style.height = height;\n }\n if (width) {\n style.width = width;\n }\n const autoHeightClass = isEmpty(style) ? 'height-100pct' : '';\n\n return (\n <div\n className={`Map position-relative map-type-${baseLayer.toLowerCase()} ${autoHeightClass}`}\n style={style}\n ref={mapRef}\n onTouchStart={handleMapInteractionStart}\n onTouchEnd={handleMapInteractionEnd}\n onMouseEnter={handleMapInteractionStart}\n onMouseOut={handleMapInteractionEnd}\n onBlur={handleMapInteractionEnd}\n >\n {isMapInitialized && api && (\n <MapContext.Provider\n value={{\n api,\n language,\n enableWebGL,\n enableMarkerIconCache,\n enableFractionalZoom,\n isZoomInteractionActive,\n showCluster,\n activeLayers,\n baseLayer,\n hideMapLayerSettings,\n hideClusterSettings,\n viewportHistory,\n onMapTypeChange: handleMapTypeChange,\n onMapLayerChange: handleMapLayerChange,\n onShowClusterChange: handleShowClusterChange,\n mapSettingsTooltip,\n onIncidentsChange,\n devicePixelRatio,\n }}\n >\n <MapPosition\n api={api}\n boundingBox={boundingBox}\n center={center}\n zoom={zoom}\n zoomAnimation={zoomAnimation}\n />\n <MapSize api={api} />\n <MapZoom\n hideZoomButtons={disableBehavior}\n onZoomIn={onZoomIn}\n onZoomOut={onZoomOut}\n zoomAnimation={zoomAnimation}\n />\n {mapSettings && mapSettings}\n <MapOverlayLayers layers={activeLayers} />\n <MapElements api={api}>{children}</MapElements>\n </MapContext.Provider>\n )}\n </div>\n );\n};\n\nMap.TYPE_DEFAULT = MAP_TYPE_DEFAULT;\nMap.TYPE_FLEET_STYLE = MAP_TYPE_FLEET_STYLE;\nMap.TYPE_SATELLITE = MAP_TYPE_SATELLITE;\nMap.TYPE_TERRAIN = MAP_TYPE_TERRAIN;\nMap.TYPE_NIGHT = MAP_TYPE_NIGHT;\n\nMap.LAYER_INCIDENTS = MAP_LAYER_INCIDENTS;\nMap.LAYER_TRAFFIC = MAP_LAYER_TRAFFIC;\nMap.LAYER_ROAD_RESTRICTIONS = MAP_LAYER_ROAD_RESTRICTIONS;\n\nexport default Map;\n"],"names":["MARKER_POINTER_EVENTS_DISABLED_CLASS","MARKER_POINTER_EVENTS_RESET_DELAY_MS","Map","props","children","credentials","width","height","lang","center","zoom","zoomAnimation","boundingBox","hideClusterSettings","hideMapLayerSettings","disableMapEvents","disableBehavior","disableZoomMomentum","enableFractionalZoom","eventListenerMap","mapType","MAP_TYPE_DEFAULT","mapLayer","externalShowCluster","showScaleBar","onMapLayerChange","onMapTypeChange","onShowClusterChange","onZoomIn","onZoomOut","onIncidentsChange","mapSettingsTooltip","mapSettings","maxViewportHistoryEntries","enableWebGL","enableDevicePixelRatio","enableMarkerIconCache","disableMarkerPointerEventsWhileZooming","pixelRatio","DEFAULT_PIXEL_RATIO","minZoom","DEFAULT_MIN_ZOOM","maxZoom","DEFAULT_MAX_ZOOM","safeMaxZoom","mapRef","useRef","markerPointerEventsResetTimeoutRef","markerPointerEventsDisabledRef","disableMarkerPointerEventsWhileZoomingRef","isMapInitialized","setMapInitialized","useState","isZoomInteractionActive","setIsZoomInteractionActive","api","setApi","baseLayer","setBaseLayer","activeLayers","setActiveLayers","showCluster","setShowCluster","controlledViewport","useMemo","viewportHistory","useMapViewportHistory","devicePixelRatio","language","locale","setMarkerPointerEventsDisabled","disabled","mapElement","clearMarkerPointerEventsResetTimeout","scheduleMarkerPointerEventsEnable","temporarilyDisableMarkerPointerEvents","useEffect","handleWheel","allMapObjects","removeMapViewChangeListeners","removeEventListenerMap","bounds","getMapBounds","platform","getPlatform","engineType","getEngineType","defaultLayers","getBaseLayer","MAP_LAYER_ROAD_RESTRICTIONS","defaultLayerMap","handleMapViewChangeStart","handleMapViewChangeEnd","hereMap","hereMapEvents","hereBehavior","addEventListenerMap","hereUi","getHereUi","createUtils","isDarkMode","useDarkMode","handleMapTypeChange","MAP_TYPE_NIGHT","previousMapLayer","setPreviousMapLayer","isEqual","newMapType","handleMapLayerChange","layer","removeLayer","layerToRemove","item","newActiveLayers","handleShowClusterChange","newShowCluster","handleMapInteractionStart","handleMapInteractionEnd","style","autoHeightClass","isEmpty","jsx","jsxs","MapContext","MapPosition","MapSize","MapZoom","MapOverlayLayers","MapElements","MAP_TYPE_FLEET_STYLE","MAP_TYPE_SATELLITE","MAP_TYPE_TERRAIN","MAP_LAYER_INCIDENTS","MAP_LAYER_TRAFFIC"],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAuC,qCACvCC,KAAuC,KAEvCC,IAAM,CAACC,OAAoB;AAC7B,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAUC,KAAO;AAAA,IACjB,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,aAAAC;AAAA,IACA,qBAAAC,KAAsB;AAAA,IACtB,sBAAAC,KAAuB;AAAA,IACvB,kBAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,qBAAAC,IAAsB;AAAA,IACtB,sBAAAC,IAAuB;AAAA,IACvB,kBAAAC;AA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AAiB9G;AAAA,gBACjB,UAAAY;AAAA,gBACA,WAAAC;AAAA,gBACA,eAAAlB;AAAA,cAAA;AAAA,YAAA;AAAA,YAEHqB,KAAeA;AAAA,YAChB,gBAAAyF,EAACM,IAAA,EAAiB,QAAQpE,EAAA,CAAc;AAAA,YACxC,gBAAA8D,EAACO,IAAA,EAAY,KAAAzE,GAAW,UAAAnD,GAAA,CAAS;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACrC;AAAA,EAAA;AAIhB;AAEAF,EAAI,eAAemB;AACnBnB,EAAI,mBAAmB+H;AACvB/H,EAAI,iBAAiBgI;AACrBhI,EAAI,eAAeiI;AACnBjI,EAAI,aAAaqG;AAEjBrG,EAAI,kBAAkBkI;AACtBlI,EAAI,gBAAgBmI;AACpBnI,EAAI,0BAA0BuF;"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { MapApi, MapIncidents, MapLayer, MapType } from '../utils/mapTypes';
|
|
2
|
+
import { MapViewportHistory } from '../hooks/useMapViewportHistory';
|
|
2
3
|
export type MapContextType = {
|
|
3
4
|
api: MapApi;
|
|
4
5
|
language: string;
|
|
5
6
|
enableWebGL: boolean;
|
|
6
7
|
enableMarkerIconCache: boolean;
|
|
8
|
+
enableFractionalZoom: boolean;
|
|
9
|
+
isZoomInteractionActive: boolean;
|
|
7
10
|
baseLayer: MapType;
|
|
8
11
|
activeLayers: MapLayer[];
|
|
9
12
|
showCluster: boolean;
|
|
@@ -14,6 +17,7 @@ export type MapContextType = {
|
|
|
14
17
|
mapSettingsTooltip?: string | React.ReactNode;
|
|
15
18
|
hideMapLayerSettings?: boolean;
|
|
16
19
|
hideClusterSettings?: boolean;
|
|
20
|
+
viewportHistory: MapViewportHistory;
|
|
17
21
|
onIncidentsChange: (incidentsResult: MapIncidents) => void;
|
|
18
22
|
};
|
|
19
23
|
export declare const defaultMapContext: MapContextType;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { createContext as e, useContext as t } from "react";
|
|
2
|
-
import { MAP_TYPE_DEFAULT as
|
|
3
|
-
|
|
2
|
+
import { MAP_TYPE_DEFAULT as o } from "./constants.js";
|
|
3
|
+
import { defaultMapViewportHistory as a } from "../hooks/useMapViewportHistory.js";
|
|
4
|
+
const r = {
|
|
4
5
|
api: {},
|
|
5
6
|
language: "en",
|
|
6
7
|
enableWebGL: !0,
|
|
7
8
|
enableMarkerIconCache: !0,
|
|
8
|
-
|
|
9
|
+
enableFractionalZoom: !1,
|
|
10
|
+
isZoomInteractionActive: !1,
|
|
11
|
+
baseLayer: o,
|
|
9
12
|
activeLayers: [],
|
|
10
13
|
showCluster: !0,
|
|
11
14
|
devicePixelRatio: 1,
|
|
15
|
+
viewportHistory: a,
|
|
12
16
|
onIncidentsChange: () => {
|
|
13
17
|
}
|
|
14
|
-
},
|
|
18
|
+
}, n = e(r), l = () => t(n);
|
|
15
19
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
n as MapContext,
|
|
21
|
+
r as defaultMapContext,
|
|
22
|
+
l as useMapContext
|
|
19
23
|
};
|
|
20
24
|
//# sourceMappingURL=MapContext.js.map
|