@rio-cloud/rio-uikit 0.16.2-beta.13 → 0.16.2-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/.DS_Store +0 -0
  2. package/Map.d.ts +2 -1
  3. package/RuleConnector.d.ts +2 -1
  4. package/RuleContainer.d.ts +3 -2
  5. package/RulesWrapper.d.ts +2 -1
  6. package/components/applicationHeader/ApplicationHeader.js +6 -3
  7. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +6 -4
  8. package/components/map/components/Map.js +26 -21
  9. package/components/map/components/features/ContextMenu.js +1 -1
  10. package/components/map/components/features/Route.js +1 -9
  11. package/components/map/components/features/basics/Circle.js +11 -6
  12. package/components/map/components/features/basics/MapLayerGroup.js +7 -5
  13. package/components/map/components/features/basics/Polygon.js +6 -5
  14. package/components/map/components/features/basics/Polyline.js +7 -31
  15. package/components/map/components/features/basics/marker/DomMarker.js +9 -3
  16. package/components/map/components/features/basics/marker/Marker.js +122 -120
  17. package/components/map/components/features/basics/marker/TextMarker.js +15 -43
  18. package/components/map/components/features/layers/Layer.js +1 -1
  19. package/components/map/components/features/layers/MarkerLayer.js +4 -3
  20. package/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
  21. package/components/map/components/features/layers/TrafficLayer.js +2 -2
  22. package/components/map/components/features/layers/clustering/ClusterLayer.js +5 -4
  23. package/components/map/utils/hooks.js +3 -3
  24. package/components/mapMarker/SingleMapMarker.js +15 -12
  25. package/components/rules/RuleContainer.js +4 -0
  26. package/components/rules/RulesWrapper.js +3 -3
  27. package/hooks/useScrollPosition.js +4 -5
  28. package/index.d.ts +29 -29
  29. package/lib/es/Map.d.ts +2 -1
  30. package/lib/es/RuleConnector.d.ts +2 -1
  31. package/lib/es/RuleContainer.d.ts +3 -2
  32. package/lib/es/RulesWrapper.d.ts +2 -1
  33. package/lib/es/components/applicationHeader/ApplicationHeader.js +5 -2
  34. package/lib/es/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +9 -4
  35. package/lib/es/components/map/components/Map.js +26 -21
  36. package/lib/es/components/map/components/features/ContextMenu.js +1 -1
  37. package/lib/es/components/map/components/features/Route.js +1 -9
  38. package/lib/es/components/map/components/features/basics/Circle.js +10 -5
  39. package/lib/es/components/map/components/features/basics/MapLayerGroup.js +7 -5
  40. package/lib/es/components/map/components/features/basics/Polygon.js +6 -5
  41. package/lib/es/components/map/components/features/basics/Polyline.js +7 -31
  42. package/lib/es/components/map/components/features/basics/marker/DomMarker.js +8 -3
  43. package/lib/es/components/map/components/features/basics/marker/Marker.js +126 -119
  44. package/lib/es/components/map/components/features/basics/marker/TextMarker.js +15 -42
  45. package/lib/es/components/map/components/features/layers/Layer.js +1 -1
  46. package/lib/es/components/map/components/features/layers/MarkerLayer.js +4 -3
  47. package/lib/es/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
  48. package/lib/es/components/map/components/features/layers/TrafficLayer.js +2 -2
  49. package/lib/es/components/map/components/features/layers/clustering/ClusterLayer.js +5 -4
  50. package/lib/es/components/map/utils/hooks.js +3 -3
  51. package/lib/es/components/mapMarker/SingleMapMarker.js +15 -12
  52. package/lib/es/components/rules/RuleContainer.js +4 -0
  53. package/lib/es/components/rules/RulesWrapper.js +3 -3
  54. package/lib/es/hooks/useScrollPosition.js +4 -5
  55. package/lib/es/index.d.ts +29 -29
  56. package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +14 -5
  57. package/lib/es/types.ts +22 -19
  58. package/lib/es/version.json +1 -1
  59. package/package.json +1 -1
  60. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +15 -6
  61. package/types.ts +22 -19
  62. package/version.json +1 -1
  63. package/components/.DS_Store +0 -0
  64. package/components/map/.DS_Store +0 -0
  65. package/components/map/components/.DS_Store +0 -0
  66. package/components/map/components/features/layers/TruckLayer.js +0 -20
  67. package/components/map/components/features/layers/baselayers/BaseLayer.js +0 -33
  68. package/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -23
  69. package/hooks/useHereMap.ts +0 -23
  70. package/hooks/useScripts.ts +0 -52
  71. package/lib/.DS_Store +0 -0
  72. package/lib/es/.DS_Store +0 -0
  73. package/lib/es/components/.DS_Store +0 -0
  74. package/lib/es/components/map/components/features/layers/TruckLayer.js +0 -28
  75. package/lib/es/components/map/components/features/layers/baselayers/BaseLayer.js +0 -41
  76. package/lib/es/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -30
  77. package/lib/es/hooks/useHereMap.ts +0 -23
  78. package/lib/es/hooks/useScripts.ts +0 -52
  79. package/lib/es/styles/.DS_Store +0 -0
  80. package/lib/es/styles/mixins/_mixins.less +0 -13
  81. package/lib/es/styles/mixins/alerts.less +0 -13
  82. package/lib/es/styles/shared/colors.json +0 -56
  83. package/lib/es/styles/shared/colors.less +0 -73
  84. package/lib/es/styles/shared/screens.less +0 -7
  85. package/lib/es/styles/shared/text.less +0 -23
  86. package/lib/es/styles/variables.less +0 -186
  87. package/lib/es/themes/.DS_Store +0 -0
  88. package/styles/.DS_Store +0 -0
  89. package/styles/mixins/_mixins.less +0 -13
  90. package/styles/mixins/alerts.less +0 -13
  91. package/styles/shared/colors.json +0 -56
  92. package/styles/shared/colors.less +0 -73
  93. package/styles/shared/screens.less +0 -7
  94. package/styles/shared/text.less +0 -23
  95. package/styles/variables.less +0 -186
  96. package/themes/.DS_Store +0 -0
  97. package/themes/Volkswagen/.DS_Store +0 -0
  98. package/themes/Website/.DS_Store +0 -0
package/.DS_Store CHANGED
Binary file
package/Map.d.ts CHANGED
@@ -3,9 +3,10 @@ import { MapProps } from './types';
3
3
 
4
4
  export { BoundingBox } from './types';
5
5
 
6
- export default class Map extends React.Component<MapProps> {
6
+ export default class Map extends React.Component<React.PropsWithChildren<MapProps>> {
7
7
  static TYPE_DEFAULT = 'DEFAULT';
8
8
  static TYPE_FLEET_STYLE = 'FLEET_STYLE';
9
9
  static TYPE_SATELLITE = 'SATELLITE';
10
10
  static TYPE_TERRAIN = 'TERRAIN';
11
+ static TYPE_NIGHT = 'NIGHT';
11
12
  }
@@ -1,7 +1,8 @@
1
1
  declare module '@rio-cloud/rio-uikit/RuleConnector' {
2
2
  import React from 'react';
3
3
  import { RuleConnectorProps } from './types';
4
- export default class RuleConnector extends React.Component<RuleConnectorProps> {
4
+
5
+ export default class RuleConnector extends React.Component<React.PropsWithChildren<RuleConnectorProps>> {
5
6
  static START = 'start';
6
7
  static CENTER = 'center';
7
8
  static END = 'end';
@@ -1,5 +1,6 @@
1
1
  declare module '@rio-cloud/rio-uikit/RuleContainer' {
2
2
  import React from 'react';
3
3
  import { RuleContainerProps } from './types';
4
- export default class RuleContainer extends React.Component<RuleContainerProps> {}
5
- }
4
+
5
+ export default class RuleContainer extends React.Component<React.PropsWithChildren<RuleContainerProps>> {}
6
+ }
package/RulesWrapper.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  declare module '@rio-cloud/rio-uikit/RulesWrapper' {
2
2
  import React from 'react';
3
3
  import { RulesWrapperProps } from './types';
4
+
4
5
  export default class RulesWrapper extends React.Component<RulesWrapperProps> {}
5
- }
6
+ }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["homeRoute", "showHomeIcon", "label", "className", "appNavigator", "appNavigatorClassName", "appMenuItems", "navItems", "actionBarItems", "onToggleAppMenu"];
5
- import React, { useState, useRef, useEffect, useCallback } from 'react';
5
+ import React, { useState, useRef, forwardRef, useCallback, useImperativeHandle } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import debounce from 'lodash/fp/debounce';
8
8
  import isEmpty from 'lodash/fp/isEmpty';
@@ -16,7 +16,7 @@ import modulePropTypes from './modulePropTypes';
16
16
  import { MobileAppMenu } from './MobileAppMenu';
17
17
  var SCREEN_SM = 768; // @screen-sm: 768px;
18
18
 
19
- export var ApplicationHeader = function ApplicationHeader(props) {
19
+ export var ApplicationHeader = /*#__PURE__*/forwardRef(function (props, ref) {
20
20
  var homeRoute = props.homeRoute,
21
21
  showHomeIcon = props.showHomeIcon,
22
22
  label = props.label,
@@ -33,6 +33,9 @@ export var ApplicationHeader = function ApplicationHeader(props) {
33
33
  _useResizeObserver2 = _slicedToArray(_useResizeObserver, 2),
34
34
  navRef = _useResizeObserver2[0],
35
35
  contentRect = _useResizeObserver2[1].contentRect;
36
+ useImperativeHandle(ref, function () {
37
+ return navRef;
38
+ }, []);
36
39
  var getContentRect = useCallback(function (key) {
37
40
  return contentRect && Math.round(contentRect[key]);
38
41
  }, [contentRect]);
@@ -81,7 +84,7 @@ export var ApplicationHeader = function ApplicationHeader(props) {
81
84
  nodeRef: actionBarRef,
82
85
  items: actionBarItems
83
86
  })));
84
- };
87
+ });
85
88
  var Divider = function Divider() {
86
89
  return /*#__PURE__*/React.createElement("div", {
87
90
  className: "divider display-flex align-items-center"
@@ -1,20 +1,22 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["className", "buttonAlignment", "useBodyPaddings", "children"];
4
- import React from 'react';
4
+ import React, { forwardRef } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import classNames from 'classnames';
7
- export var ApplicationLayoutBodyBottomBar = function ApplicationLayoutBodyBottomBar(_ref) {
7
+ export var ApplicationLayoutBodyBottomBar = /*#__PURE__*/forwardRef(function (_ref, ref) {
8
8
  var className = _ref.className,
9
9
  buttonAlignment = _ref.buttonAlignment,
10
10
  useBodyPaddings = _ref.useBodyPaddings,
11
11
  children = _ref.children,
12
12
  remainigProps = _objectWithoutProperties(_ref, _excluded);
13
13
  var classes = classNames('ApplicationLayoutBodyBottomBar', buttonAlignment === 'left' && 'justify-content-start', buttonAlignment === 'right' && 'justify-content-end', buttonAlignment !== 'left' && buttonAlignment !== 'right' && 'justify-content-between', useBodyPaddings && 'use-body-padding', className && className);
14
- return /*#__PURE__*/React.createElement("div", _extends({}, remainigProps, {
14
+ return /*#__PURE__*/React.createElement("div", _extends({
15
+ ref: ref
16
+ }, remainigProps, {
15
17
  className: classes
16
18
  }), children);
17
- };
19
+ });
18
20
  ApplicationLayoutBodyBottomBar.LEFT = 'left';
19
21
  ApplicationLayoutBodyBottomBar.RIGHT = 'right';
20
22
  ApplicationLayoutBodyBottomBar.defaultProps = {
@@ -10,6 +10,7 @@ import isFunction from 'lodash/fp/isFunction';
10
10
  import map from 'lodash/fp/map';
11
11
  import isEmpty from 'lodash/fp/isEmpty';
12
12
  import throttle from 'lodash/fp/throttle';
13
+ import cloneDeep from 'lodash/fp/cloneDeep';
13
14
  import mapProps from '../utils/proptypes';
14
15
  import addEventListener from '../../../utils/addEventListener';
15
16
  import '../herePolyfill';
@@ -197,19 +198,6 @@ var Map = function Map(props) {
197
198
  _useState10 = _slicedToArray(_useState9, 2),
198
199
  showCluster = _useState10[0],
199
200
  setShowCluster = _useState10[1];
200
- var isDarkMode = useDarkMode();
201
- useEffect(function () {
202
- // Toggle night map only if current map type is default
203
- if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {
204
- setBaseLayer(MAP_TYPE_NIGHT);
205
- onMapTypeChange(MAP_TYPE_NIGHT);
206
- }
207
- // Toggle back to default map only if current map type is night
208
- else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {
209
- setBaseLayer(MAP_TYPE_DEFAULT);
210
- onMapTypeChange(MAP_TYPE_DEFAULT);
211
- }
212
- }, [isDarkMode]);
213
201
  var devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || 1 : 1;
214
202
  useEffect(function () {
215
203
  console.debug('initialize here map');
@@ -238,10 +226,12 @@ var Map = function Map(props) {
238
226
  var hereMapEvents = !disableMapEvents && new H.mapevents.MapEvents(hereMap);
239
227
  var hereBehavior = !(disableMapEvents || disableBehavior) && new H.mapevents.Behavior(hereMapEvents);
240
228
  addEventListenerMap(hereMap, eventListenerMap, hereMap);
229
+
230
+ // The api will be passed to services when using a render function.
231
+ // This allows the service to access the map internals
241
232
  setApi({
242
233
  credentials: credentials,
243
234
  defaultLayers: defaultLayers,
244
- group: hereMap,
245
235
  map: hereMap,
246
236
  mapEvents: hereMapEvents,
247
237
  behavior: hereBehavior,
@@ -270,6 +260,17 @@ var Map = function Map(props) {
270
260
  }
271
261
  };
272
262
  }, [enableWebGL, enableDevicePixelRatio]);
263
+ var isDarkMode = useDarkMode();
264
+ useEffect(function () {
265
+ // Toggle night map only if current map type is default
266
+ if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {
267
+ handleMapTypeChange(MAP_TYPE_NIGHT);
268
+ }
269
+ // Toggle back to default map only if current map type is night
270
+ else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {
271
+ handleMapTypeChange(MAP_TYPE_DEFAULT);
272
+ }
273
+ }, [isDarkMode]);
273
274
 
274
275
  // Update BoundingBox from outside
275
276
  useEffect(function () {
@@ -308,7 +309,7 @@ var Map = function Map(props) {
308
309
 
309
310
  // Update MapType from outside
310
311
  useEffect(function () {
311
- return setBaseLayer(mapType);
312
+ return handleMapTypeChange(mapType);
312
313
  }, [mapType]);
313
314
 
314
315
  // Update MapLayer from outside
@@ -323,11 +324,13 @@ var Map = function Map(props) {
323
324
  var handleMapTypeChange = function handleMapTypeChange(newMapType) {
324
325
  setBaseLayer(newMapType);
325
326
  onMapTypeChange(newMapType, mapType);
326
- setApi(_objectSpread(_objectSpread({}, api), {}, {
327
- settings: _objectSpread(_objectSpread({}, api.settings), {}, {
328
- baseLayer: newMapType
329
- })
330
- }));
327
+ if (api) {
328
+ setApi(_objectSpread(_objectSpread({}, api), {}, {
329
+ settings: _objectSpread(_objectSpread({}, api.settings), {}, {
330
+ baseLayer: newMapType
331
+ })
332
+ }));
333
+ }
331
334
  };
332
335
  var handleMapLayerChange = function handleMapLayerChange(layer) {
333
336
  var removeLayer = function removeLayer(layerToRemove) {
@@ -373,7 +376,9 @@ var Map = function Map(props) {
373
376
  style: style,
374
377
  ref: mapRef
375
378
  }, isMapInitialized && /*#__PURE__*/React.createElement(MapContext.Provider, {
376
- value: api
379
+ value: {
380
+ api: api
381
+ }
377
382
  }, !hideZoomButtons && /*#__PURE__*/React.createElement(ZoomButtons, {
378
383
  onZoomIn: handleZoomIn,
379
384
  onZoomOut: handleZoomOut
@@ -80,7 +80,7 @@ var ContextMenu = function ContextMenu(props) {
80
80
  contextMenuEvent = props.contextMenuEvent,
81
81
  targetPosition = props.targetPosition;
82
82
  var mapContext = useContext(MapContext);
83
- var _ref = api || mapContext,
83
+ var _ref = api || mapContext.api,
84
84
  hereMap = _ref.map;
85
85
 
86
86
  // Use a ref to store the target position used when a map object was clicked with a fixed
@@ -23,14 +23,6 @@ var defaultStyle = {
23
23
  borderColor: 'rgba(54, 144, 174, 1)',
24
24
  isBorderIncludedInWidth: false
25
25
  };
26
- var defaultArrowStyle = {
27
- // lineWidth: 12,
28
- // strokeColor: 'rgba(0, 0, 0, 0.8)',
29
- // lineDash: [0, 3],
30
- // lineDashOffset: 2,
31
- // lineTailCap: 'arrow-tail',
32
- // lineHeadCap: 'arrow-head',
33
- };
34
26
  var alternativeRouteStyle = _objectSpread(_objectSpread({}, defaultStyle), {}, {
35
27
  color: 'rgb(218,253,255)'
36
28
  });
@@ -143,7 +135,7 @@ var Route = function Route(props) {
143
135
  };
144
136
  Route.defaultProps = {
145
137
  hasArrows: true,
146
- arrowStyle: defaultArrowStyle,
138
+ arrowStyle: {},
147
139
  isReduced: false,
148
140
  isRouteAlternative: false,
149
141
  markers: []
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /* eslint-disable no-undef */
3
- import { useContext, useState, useEffect } from 'react';
3
+ import { useContext, useState, useEffect, useRef } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import mapProps from '../../../utils/proptypes';
6
6
  import { MapContext } from '../../context';
@@ -13,25 +13,30 @@ var Circle = function Circle(_ref) {
13
13
  precision = _ref$precision === void 0 ? 60 : _ref$precision,
14
14
  style = _ref.style,
15
15
  eventListenerMap = _ref.eventListenerMap;
16
- var context = useContext(MapContext);
16
+ var _useContext = useContext(MapContext),
17
+ api = _useContext.api;
17
18
  var _useState = useState(),
18
19
  _useState2 = _slicedToArray(_useState, 2),
19
20
  circle = _useState2[0],
20
21
  setCircle = _useState2[1];
22
+
23
+ // Create a new circle and check for changes on the map itself.
24
+ // The map instance may change due to rendering changes like webgl vs raster.
25
+ // In this case, add the circle to the new map instance otherwise it will be gone.
21
26
  useEffect(function () {
22
27
  var newCircle = new H.map.Circle(position, radius, {
23
28
  style: style,
24
29
  precision: parseFloat(precision)
25
30
  });
26
31
  setCircle(newCircle);
27
- context.group.addObject(newCircle);
32
+ api.map.addObject(newCircle);
28
33
  return function () {
29
- if (context.group.getObjects().includes(newCircle)) {
30
- context.group.removeObject(newCircle);
34
+ if (api.map.getObjects().includes(newCircle)) {
35
+ api.map.removeObject(newCircle);
31
36
  }
32
37
  newCircle.dispose();
33
38
  };
34
- }, []);
39
+ }, [api.map]);
35
40
  useUpdateProp(circle, 'setCenter', position);
36
41
  useUpdateProp(circle, 'setStyle', style);
37
42
  useUpdateProp(circle, 'setRadius', radius);
@@ -26,19 +26,21 @@ var MapLayerGroup = function MapLayerGroup(_ref) {
26
26
  max: parseFloat(maxZoom)
27
27
  });
28
28
  newGroup.setVisibility(isVisible);
29
- context.group.addObject(newGroup);
29
+ context.api.map.addObject(newGroup);
30
30
  setGroup(newGroup);
31
31
  var newChildApi = _objectSpread(_objectSpread({}, context), {}, {
32
- group: newGroup
32
+ api: _objectSpread(_objectSpread({}, context.api), {}, {
33
+ group: newGroup
34
+ })
33
35
  });
34
36
  setChildApi(newChildApi);
35
37
  return function () {
36
- if (context.group.getObjects().includes(newGroup)) {
37
- context.group.removeObject(newGroup);
38
+ if (context.api.map.getObjects().includes(newGroup)) {
39
+ context.api.map.removeObject(newGroup);
38
40
  }
39
41
  newGroup.dispose();
40
42
  };
41
- }, []);
43
+ }, [api.map]);
42
44
  useEffect(function () {
43
45
  if (group) {
44
46
  group.setVisibility(isVisible);
@@ -21,7 +21,8 @@ var Polygon = function Polygon(_ref) {
21
21
  _ref$style = _ref.style,
22
22
  style = _ref$style === void 0 ? H.map.SpatialStyle.DEFAULT_STYLE : _ref$style,
23
23
  eventListenerMap = _ref.eventListenerMap;
24
- var context = useContext(MapContext);
24
+ var _useContext = useContext(MapContext),
25
+ api = _useContext.api;
25
26
  var _useState = useState(),
26
27
  _useState2 = _slicedToArray(_useState, 2),
27
28
  polygon = _useState2[0],
@@ -30,15 +31,15 @@ var Polygon = function Polygon(_ref) {
30
31
  var newPolygon = new H.map.Polygon(createGeometry(points), {
31
32
  style: style
32
33
  });
33
- context.group.addObject(newPolygon);
34
+ api.map.addObject(newPolygon);
34
35
  setPolygon(newPolygon);
35
36
  return function () {
36
- if (context.group.getObjects().includes(newPolygon)) {
37
- context.group.removeObject(newPolygon);
37
+ if (api.map.getObjects().includes(newPolygon)) {
38
+ api.map.removeObject(newPolygon);
38
39
  }
39
40
  newPolygon.dispose();
40
41
  };
41
- }, []);
42
+ }, [api.map]);
42
43
  useEffect(function () {
43
44
  if (polygon) {
44
45
  polygon.setGeometry(createGeometry(points));
@@ -18,7 +18,8 @@ var Polyline = function Polyline(_ref) {
18
18
  _ref$style = _ref.style,
19
19
  style = _ref$style === void 0 ? H.map.SpatialStyle.DEFAULT_STYLE : _ref$style,
20
20
  eventListenerMap = _ref.eventListenerMap;
21
- var context = useContext(MapContext);
21
+ var _useContext = useContext(MapContext),
22
+ api = _useContext.api;
22
23
  var _useState = useState(),
23
24
  _useState2 = _slicedToArray(_useState, 2),
24
25
  polyline = _useState2[0],
@@ -35,9 +36,7 @@ var Polyline = function Polyline(_ref) {
35
36
  style: style
36
37
  });
37
38
  if (hasArrows) {
38
- // Create a patterned polyline:
39
-
40
- // Non-legacy version:
39
+ // Create a patterned polyline
41
40
  var arrowLineStyle = new H.map.SpatialStyle(_objectSpread(_objectSpread({}, arrowStyle), {}, {
42
41
  lineWidth: 10,
43
42
  strokeColor: 'rgba(0, 0, 0, 0.8)',
@@ -56,43 +55,20 @@ var Polyline = function Polyline(_ref) {
56
55
  } else {
57
56
  lineGroup.addObjects([line]);
58
57
  }
59
- context.group.addObject(lineGroup);
58
+ api.map.addObject(lineGroup);
60
59
  setPolyline(lineGroup);
61
60
  return function () {
62
- // cleanup
63
- //console.log('cleanup polyline');
64
-
65
61
  removeEventListenerMap(lineGroup);
66
62
  lineGroup.forEach(function (singleLine) {
67
63
  lineGroup.removeObject(singleLine);
68
64
  singleLine.dispose();
69
65
  });
70
- if (context.group.getObjects().includes(lineGroup)) {
71
- context.group.removeObject(lineGroup);
66
+ if (api.map.getObjects().includes(lineGroup)) {
67
+ api.map.removeObject(lineGroup);
72
68
  }
73
69
  lineGroup.dispose();
74
70
  };
75
- }, [geometry, style, hasArrows, arrowStyle]);
76
-
77
- /*useEffect(() => {
78
- if (polyline) {
79
- polyline.forEach((line, index) => {
80
- if (index === 0) {
81
- line.setStyle(style);
82
- } else {
83
- line.setStyle(arrowStyle);
84
- }
85
- });
86
- }
87
- }, [style, arrowStyle]);*/
88
-
89
- /*useEffect(() => {
90
- if (polyline) {
91
- polyline.forEach(line => line.setGeometry(geometry));
92
- }
93
- }, [geometry]);*/
94
-
95
- //useUpdateProp(polyline, 'setStyle', style);
71
+ }, [api.map, geometry, style, hasArrows, arrowStyle]);
96
72
  useUpdateEventListenerMap(polyline, eventListenerMap);
97
73
  return null;
98
74
  };
@@ -10,6 +10,12 @@ import React from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import mapProps from '../../../../utils/proptypes';
12
12
  import { addEventListenerMap, removeEventListenerMap, checkAndUpdateEventListenerMap } from '../../../../utils/eventHandling';
13
+
14
+ // Should be deprecated...
15
+ // Here Documentation:
16
+ // It should be only used where small numbers of markers with dynamic style and/or scripted icons are to be displayed
17
+ // on the map (for example animated interactive SVG). Otherwise a H.map.Marker should be preferred for performance reasons.
18
+ //
13
19
  var DomMarker = /*#__PURE__*/function (_React$Component) {
14
20
  _inherits(DomMarker, _React$Component);
15
21
  var _super = _createSuper(DomMarker);
@@ -21,7 +27,7 @@ var DomMarker = /*#__PURE__*/function (_React$Component) {
21
27
  _this.marker = new H.map.DomMarker(_this.convertPosition(props.position), {
22
28
  icon: icon
23
29
  });
24
- context.api.group.addObject(_this.marker);
30
+ context.api.map.addObject(_this.marker);
25
31
  addEventListenerMap(_this.marker, props.eventListenerMap, _this.context.api.map);
26
32
  return _this;
27
33
  }
@@ -48,8 +54,8 @@ var DomMarker = /*#__PURE__*/function (_React$Component) {
48
54
  key: "componentWillUnmount",
49
55
  value: function componentWillUnmount() {
50
56
  removeEventListenerMap(this.marker);
51
- if (this.context.api.group.includes(this.marker)) {
52
- this.context.api.group.removeObject(this.marker);
57
+ if (this.context.api.map.includes(this.marker)) {
58
+ this.context.api.map.removeObject(this.marker);
53
59
  }
54
60
  this.marker.dispose();
55
61
  }