@opengeoweb/core 4.6.1 → 4.7.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.
Files changed (27) hide show
  1. package/index.esm.js +883 -675
  2. package/index.umd.js +767 -542
  3. package/lib/components/LayerManager/DockedLayerManagerConnect.d.ts +2 -0
  4. package/lib/components/ReactMapView/AdagucMapDraw.d.ts +0 -11
  5. package/lib/components/ReactMapView/AdagucMapDrawTools.d.ts +18 -0
  6. package/lib/components/ReactMapView/ReactMapView.d.ts +1 -2
  7. package/lib/components/ReactMapView/types.d.ts +1 -3
  8. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +2 -1
  9. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +0 -5
  10. package/lib/components/TimeSlider/TimeSliderButtons/PlayButton/PlayButtonConnect.d.ts +1 -1
  11. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.d.ts +2 -1
  12. package/lib/components/TimeSlider/TimeSliderButtons/TimeStepButton/TimeStepButton.d.ts +1 -1
  13. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegend.d.ts +2 -2
  14. package/lib/components/TimeSlider/TimeSliderUtils.d.ts +7 -3
  15. package/lib/components/TimeSlider/index.d.ts +1 -0
  16. package/lib/hooks/useSetupDialog/useSetupDialog.d.ts +2 -1
  17. package/lib/index.d.ts +10 -10
  18. package/lib/store/mapStore/layers/reducer.d.ts +3 -1
  19. package/lib/store/mapStore/layers/selectors.d.ts +40 -0
  20. package/lib/store/mapStore/layers/types.d.ts +4 -0
  21. package/lib/store/mapStore/map/reducer.d.ts +2 -10
  22. package/lib/store/mapStore/map/sagas.d.ts +0 -5
  23. package/lib/store/mapStore/map/selectors.d.ts +25 -52
  24. package/lib/store/mapStore/map/types.d.ts +0 -23
  25. package/lib/store/mapStore/map/utils.d.ts +5 -4
  26. package/lib/store/ui/types.d.ts +2 -1
  27. package/package.json +7 -6
package/index.esm.js CHANGED
@@ -370,6 +370,13 @@ var LayerActionOrigin;
370
370
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
371
371
  })(LayerActionOrigin || (LayerActionOrigin = {}));
372
372
 
373
+ var types$3 = /*#__PURE__*/Object.freeze({
374
+ __proto__: null,
375
+ get LayerType () { return LayerType; },
376
+ get LayerStatus () { return LayerStatus; },
377
+ get LayerActionOrigin () { return LayerActionOrigin; }
378
+ });
379
+
373
380
  /* *
374
381
  * Licensed under the Apache License, Version 2.0 (the "License");
375
382
  * you may not use this file except in compliance with the License.
@@ -740,6 +747,14 @@ var getDataLimitsFromLayers = function getDataLimitsFromLayers(layers) {
740
747
  */
741
748
  [2147483647, 0]);
742
749
  };
750
+ var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
751
+ var newValue = value + 1;
752
+ return newValue > max ? max : newValue;
753
+ };
754
+ var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
755
+ var newValue = value - 1;
756
+ return newValue < min ? min : newValue;
757
+ };
743
758
  var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
744
759
  var prevTimeStep = moment.utc(curTime).subtract(timeStep, 'm').toISOString();
745
760
 
@@ -766,43 +781,39 @@ var setNextTimeStep = function setNextTimeStep(timeStep, curTime, dataEndTime, o
766
781
 
767
782
  onsetNewDateDebounced(nextTimeStep, onSetNewDate);
768
783
  };
769
- var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
770
- switch (timeInterval.isRegularInterval) {
771
- case false:
772
- switch (timeInterval.year) {
773
- case 0:
774
- // month
775
- return 30 * 24 * 60;
776
-
777
- default:
778
- return timeInterval.year * 365 * 24 * 60;
779
- }
784
+ var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max) {
785
+ var supportFourDirectionNavigation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
780
786
 
781
- case true:
782
- if (timeInterval.day !== 0) {
783
- return timeInterval.day * 24 * 60;
784
- }
785
-
786
- if (timeInterval.hour !== 0) {
787
- return timeInterval.hour * 60;
788
- }
787
+ if (!supportFourDirectionNavigation) {
788
+ if (event.ctrlKey || event.metaKey) {
789
+ switch (event.key) {
790
+ case 'ArrowDown':
791
+ return getPreviousTimeStepvalue(value, min);
789
792
 
790
- if (timeInterval.minute !== 0) {
791
- return timeInterval.minute;
792
- }
793
+ case 'ArrowUp':
794
+ return getNextTimeStepvalue(value, max);
793
795
 
794
- if (timeInterval.second !== 0) {
795
- return timeInterval.second / 60.0;
796
+ default:
797
+ return null;
796
798
  }
799
+ }
800
+ } else {
801
+ // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
802
+ switch (event.key) {
803
+ case 'ArrowDown':
804
+ case 'ArrowLeft':
805
+ return getPreviousTimeStepvalue(value, min);
797
806
 
798
- return 5;
807
+ case 'ArrowUp':
808
+ case 'ArrowRight':
809
+ return getNextTimeStepvalue(value, max);
799
810
 
800
- default:
801
- return 5;
811
+ default:
812
+ return null;
813
+ }
802
814
  }
803
- };
804
- var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
805
- return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
815
+
816
+ return null;
806
817
  };
807
818
  /**
808
819
  * This function calculates a suitable secondsPerpx value,
@@ -849,11 +860,38 @@ var scaleToSecondsPerPx = _toConsumableArray(secondsPerPxToScale.entries()).redu
849
860
 
850
861
  return Object.assign(Object.assign({}, acc), _defineProperty({}, v, Number(k)));
851
862
  }, {});
863
+ /**
864
+ * This function creates and returns an array where there is secondsPerPx
865
+ * number of the data set added for a data scale (dataScaleToSecondsPerPx)
866
+ * to secondsPerPxToScale.
867
+ * @param dataScaleToSecondsPerPx
868
+ * @returns an array containing secondsPerPx numbers.
869
+ * The secondsPerPx number for a data scale is included
870
+ * contrary to secondsPerPxToScale.
871
+ */
872
+
873
+ var secondsPerPxValues = function secondsPerPxValues(dataScaleToSecondsPerPx) {
874
+ var sortedSecondsPerPx = _toConsumableArray(secondsPerPxToScale).map(function (value) {
875
+ return Number(value[0]);
876
+ });
877
+
878
+ var full = [].concat(_toConsumableArray(sortedSecondsPerPx), [dataScaleToSecondsPerPx]);
879
+ return full;
880
+ };
852
881
  var defaultDataScaleToSecondsPerPx = 43200;
853
882
  var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTimePoint, oldSecondsPerPx, newSecondsPerPx, oldCenterTime) {
854
883
  var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
855
884
  return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
856
885
  };
886
+ /**
887
+ * Move the time slider such that a given time point (timePoint)
888
+ * is at a given pixel width (timePointPx).
889
+ * @returns a new center time for the resulting position
890
+ */
891
+
892
+ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
893
+ return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
894
+ };
857
895
  /** This reusable custom hook tells whether given pointer event targets current canvas node.
858
896
  * Example:
859
897
  *
@@ -891,6 +929,10 @@ var needleGeom = {
891
929
  cornerRadius: 5,
892
930
  lineWidth: 1
893
931
  };
932
+ var AUTO_MOVE_AREA_PADDING = 1;
933
+ var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
934
+ return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
935
+ };
894
936
  /** Reusable business logic for how to handle events that set time to now (closest).
895
937
  * Used in NowButton and TimeSliderLegend.
896
938
  */
@@ -910,6 +952,92 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
910
952
  }
911
953
  }
912
954
  };
955
+ var TimeInMinutes;
956
+
957
+ (function (TimeInMinutes) {
958
+ TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
959
+ TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
960
+ TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
961
+ TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
962
+ })(TimeInMinutes || (TimeInMinutes = {}));
963
+
964
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
965
+ var dateStr = '';
966
+ var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
967
+
968
+ if (time >= TimeInMinutes.YEAR) {
969
+ var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
970
+ dateStr += "".concat(yearsInMintues, "y");
971
+ time -= yearsInMintues * TimeInMinutes.YEAR;
972
+ }
973
+
974
+ if (time >= TimeInMinutes.MONTH) {
975
+ var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
976
+ dateStr += "".concat(monthsInMinutes, "m");
977
+ time -= monthsInMinutes * TimeInMinutes.MONTH;
978
+ }
979
+
980
+ if (time >= TimeInMinutes.DAY) {
981
+ var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
982
+ dateStr += "".concat(daysInMinutes, "d");
983
+ time -= daysInMinutes * TimeInMinutes.DAY;
984
+ } // we will always print hour/minutes if there are any of them in the XX:XX format
985
+
986
+
987
+ if (time > 0) {
988
+ if (dateStr !== '') dateStr += ' ';
989
+ dateStr += "".concat(Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
990
+ minimumIntegerDigits: 2,
991
+ useGrouping: false
992
+ }), "h").concat((time % TimeInMinutes.HOUR).toLocaleString(undefined, {
993
+ minimumIntegerDigits: 2,
994
+ useGrouping: false
995
+ }), "min");
996
+ }
997
+
998
+ return dateStr;
999
+ };
1000
+
1001
+ var TimeSliderUtils = /*#__PURE__*/Object.freeze({
1002
+ __proto__: null,
1003
+ millisecondsInSecond: millisecondsInSecond,
1004
+ defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
1005
+ defaultDelay: defaultDelay,
1006
+ defaultTimeStep: defaultTimeStep,
1007
+ speedFactors: speedFactors,
1008
+ getSpeedDelay: getSpeedDelay,
1009
+ getSpeedFactor: getSpeedFactor,
1010
+ getSelectedTime: getSelectedTime,
1011
+ getTimeBounds: getTimeBounds,
1012
+ getMomentTimeBounds: getMomentTimeBounds,
1013
+ scalingCoefficient: scalingCoefficient,
1014
+ timestampToPixelEdges: timestampToPixelEdges,
1015
+ timestampToPixel: timestampToPixel,
1016
+ pixelToTimestamp: pixelToTimestamp,
1017
+ onsetNewDateDebounced: onsetNewDateDebounced,
1018
+ roundWithTimeStep: roundWithTimeStep,
1019
+ setNewRoundedTime: setNewRoundedTime,
1020
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
1021
+ getNextTimeStepvalue: getNextTimeStepvalue,
1022
+ getPreviousTimeStepvalue: getPreviousTimeStepvalue,
1023
+ setPreviousTimeStep: setPreviousTimeStep,
1024
+ setNextTimeStep: setNextTimeStep,
1025
+ getValueFromKeyboardEvent: getValueFromKeyboardEvent,
1026
+ getScaleToSecondsPerPxForDataScale: getScaleToSecondsPerPxForDataScale,
1027
+ secondsPerPxToScale: secondsPerPxToScale,
1028
+ scaleToSecondsPerPx: scaleToSecondsPerPx,
1029
+ secondsPerPxValues: secondsPerPxValues,
1030
+ defaultDataScaleToSecondsPerPx: defaultDataScaleToSecondsPerPx,
1031
+ getNewCenterOfFixedPointZoom: getNewCenterOfFixedPointZoom,
1032
+ moveRelativeToTimePoint: moveRelativeToTimePoint,
1033
+ useCanvasTarget: useCanvasTarget,
1034
+ needleGeom: needleGeom,
1035
+ AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
1036
+ getAutoMoveAreaWidth: getAutoMoveAreaWidth,
1037
+ handleSetNowEvent: handleSetNowEvent,
1038
+ get TimeInMinutes () { return TimeInMinutes; },
1039
+ minutesToDescribedDuration: minutesToDescribedDuration
1040
+ });
913
1041
 
914
1042
  var createMap = function createMap(_ref) {
915
1043
  var id = _ref.id,
@@ -960,18 +1088,12 @@ var createMap = function createMap(_ref) {
960
1088
  isTimeSliderHoverOn = _ref$isTimeSliderHove === void 0 ? false : _ref$isTimeSliderHove,
961
1089
  _ref$isTimeSliderVisi = _ref.isTimeSliderVisible,
962
1090
  isTimeSliderVisible = _ref$isTimeSliderVisi === void 0 ? true : _ref$isTimeSliderVisi,
963
- _ref$activeMapPresetI = _ref.activeMapPresetId,
964
- activeMapPresetId = _ref$activeMapPresetI === void 0 ? null : _ref$activeMapPresetI,
965
1091
  _ref$displayMapPin = _ref.displayMapPin,
966
1092
  displayMapPin = _ref$displayMapPin === void 0 ? false : _ref$displayMapPin,
967
1093
  _ref$disableMapPin = _ref.disableMapPin,
968
1094
  disableMapPin = _ref$disableMapPin === void 0 ? false : _ref$disableMapPin,
969
1095
  _ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
970
- shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? true : _ref$shouldShowZoomCo,
971
- _ref$dockedLayerManag = _ref.dockedLayerManager,
972
- dockedLayerManager = _ref$dockedLayerManag === void 0 ? {
973
- isOpen: false
974
- } : _ref$dockedLayerManag;
1096
+ shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? true : _ref$shouldShowZoomCo;
975
1097
  return {
976
1098
  id: id,
977
1099
  isAnimating: isAnimating,
@@ -995,11 +1117,9 @@ var createMap = function createMap(_ref) {
995
1117
  isTimestepAuto: isTimestepAuto,
996
1118
  isTimeSliderHoverOn: isTimeSliderHoverOn,
997
1119
  isTimeSliderVisible: isTimeSliderVisible,
998
- activeMapPresetId: activeMapPresetId,
999
1120
  displayMapPin: displayMapPin,
1000
1121
  disableMapPin: disableMapPin,
1001
- shouldShowZoomControls: shouldShowZoomControls,
1002
- dockedLayerManager: dockedLayerManager
1122
+ shouldShowZoomControls: shouldShowZoomControls
1003
1123
  };
1004
1124
  };
1005
1125
  var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
@@ -1139,6 +1259,44 @@ function moveArrayElements(array, oldIndex, newIndex) {
1139
1259
  newArray.splice(indexNew, 0, newArray.splice(oldIndex, 1)[0]);
1140
1260
  return newArray;
1141
1261
  }
1262
+ var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
1263
+ switch (timeInterval.isRegularInterval) {
1264
+ case false:
1265
+ switch (timeInterval.year) {
1266
+ case 0:
1267
+ // month
1268
+ return 30 * 24 * 60;
1269
+
1270
+ default:
1271
+ return timeInterval.year * 365 * 24 * 60;
1272
+ }
1273
+
1274
+ case true:
1275
+ if (timeInterval.day !== 0) {
1276
+ return timeInterval.day * 24 * 60;
1277
+ }
1278
+
1279
+ if (timeInterval.hour !== 0) {
1280
+ return timeInterval.hour * 60;
1281
+ }
1282
+
1283
+ if (timeInterval.minute !== 0) {
1284
+ return timeInterval.minute;
1285
+ }
1286
+
1287
+ if (timeInterval.second !== 0) {
1288
+ return timeInterval.second / 60.0;
1289
+ }
1290
+
1291
+ return 5;
1292
+
1293
+ default:
1294
+ return 5;
1295
+ }
1296
+ };
1297
+ var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
1298
+ return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
1299
+ };
1142
1300
 
1143
1301
  var utils = /*#__PURE__*/Object.freeze({
1144
1302
  __proto__: null,
@@ -1148,7 +1306,9 @@ var utils = /*#__PURE__*/Object.freeze({
1148
1306
  produceDraftStateSetWebMapDimension: produceDraftStateSetWebMapDimension,
1149
1307
  findMapIdFromLayerId: findMapIdFromLayerId,
1150
1308
  produceDraftStateSetMapDimensionFromLayerChangeDimension: produceDraftStateSetMapDimensionFromLayerChangeDimension,
1151
- moveArrayElements: moveArrayElements
1309
+ moveArrayElements: moveArrayElements,
1310
+ getTimeStepFromDataInterval: getTimeStepFromDataInterval,
1311
+ getActiveLayerTimeStep: getActiveLayerTimeStep
1152
1312
  });
1153
1313
 
1154
1314
  /* *
@@ -1694,13 +1854,24 @@ var slice$6 = createSlice({
1694
1854
  var dimensionsAction = layerActions.layerSetDimensions(layerDimensions);
1695
1855
  var newState = layerDimensions === null ? intermediateState : reducer$6(intermediateState, dimensionsAction);
1696
1856
  return newState;
1857
+ },
1858
+ setSelectedFeature: function setSelectedFeature(draft, action) {
1859
+ var _action$payload13 = action.payload,
1860
+ layerId = _action$payload13.layerId,
1861
+ selectedFeatureIndex = _action$payload13.selectedFeatureIndex;
1862
+
1863
+ if (!draft.byId[layerId]) {
1864
+ return;
1865
+ }
1866
+
1867
+ draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
1697
1868
  }
1698
1869
  },
1699
1870
  extraReducers: function extraReducers(builder) {
1700
1871
  builder.addCase(setTimeSync, function (draft, action) {
1701
- var _action$payload13 = action.payload,
1702
- targetsFromAction = _action$payload13.targets,
1703
- source = _action$payload13.source;
1872
+ var _action$payload14 = action.payload,
1873
+ targetsFromAction = _action$payload14.targets,
1874
+ source = _action$payload14.source;
1704
1875
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
1705
1876
 
1706
1877
  var targets = [{
@@ -1726,9 +1897,9 @@ var slice$6 = createSlice({
1726
1897
  * These targets can be used as payloads in new Layer actions.
1727
1898
  * These actions are here handled via the layer reducer, as it is the same logic
1728
1899
  */
1729
- var _action$payload14 = action.payload,
1730
- targets = _action$payload14.targets,
1731
- source = _action$payload14.source;
1900
+ var _action$payload15 = action.payload,
1901
+ targets = _action$payload15.targets,
1902
+ source = _action$payload15.source;
1732
1903
  var state = current(draft);
1733
1904
  return targets.reduce(function (prevState, target) {
1734
1905
  var action = {
@@ -2263,21 +2434,10 @@ var slice$3 = createSlice({
2263
2434
 
2264
2435
  draft.byId[mapId].animationEndTime = animationEndTime;
2265
2436
  },
2266
- setSelectedFeature: function setSelectedFeature(draft, action) {
2437
+ setAnimationDelay: function setAnimationDelay(draft, action) {
2267
2438
  var _action$payload7 = action.payload,
2268
2439
  mapId = _action$payload7.mapId,
2269
- selectedFeatureIndex = _action$payload7.selectedFeatureIndex;
2270
-
2271
- if (!draft.byId[mapId]) {
2272
- return;
2273
- }
2274
-
2275
- draft.byId[mapId].selectedFeatureIndex = selectedFeatureIndex;
2276
- },
2277
- setAnimationDelay: function setAnimationDelay(draft, action) {
2278
- var _action$payload8 = action.payload,
2279
- mapId = _action$payload8.mapId,
2280
- animationDelay = _action$payload8.animationDelay;
2440
+ animationDelay = _action$payload7.animationDelay;
2281
2441
 
2282
2442
  if (!draft.byId[mapId]) {
2283
2443
  return;
@@ -2286,10 +2446,10 @@ var slice$3 = createSlice({
2286
2446
  draft.byId[mapId].animationDelay = animationDelay;
2287
2447
  },
2288
2448
  layerMoveLayer: function layerMoveLayer(draft, action) {
2289
- var _action$payload9 = action.payload,
2290
- oldIndex = _action$payload9.oldIndex,
2291
- newIndex = _action$payload9.newIndex,
2292
- mapId = _action$payload9.mapId;
2449
+ var _action$payload8 = action.payload,
2450
+ oldIndex = _action$payload8.oldIndex,
2451
+ newIndex = _action$payload8.newIndex,
2452
+ mapId = _action$payload8.mapId;
2293
2453
 
2294
2454
  if (!draft.byId[mapId]) {
2295
2455
  return;
@@ -2298,9 +2458,9 @@ var slice$3 = createSlice({
2298
2458
  draft.byId[mapId].mapLayers = moveArrayElements(draft.byId[mapId].mapLayers, oldIndex, newIndex);
2299
2459
  },
2300
2460
  setActiveLayerId: function setActiveLayerId(draft, action) {
2301
- var _action$payload10 = action.payload,
2302
- mapId = _action$payload10.mapId,
2303
- layerId = _action$payload10.layerId;
2461
+ var _action$payload9 = action.payload,
2462
+ mapId = _action$payload9.mapId,
2463
+ layerId = _action$payload9.layerId;
2304
2464
 
2305
2465
  if (!draft.byId[mapId]) {
2306
2466
  return;
@@ -2309,9 +2469,9 @@ var slice$3 = createSlice({
2309
2469
  draft.byId[mapId].activeLayerId = layerId;
2310
2470
  },
2311
2471
  setTimeSliderCenterTime: function setTimeSliderCenterTime(draft, action) {
2312
- var _action$payload11 = action.payload,
2313
- mapId = _action$payload11.mapId,
2314
- timeSliderCenterTime = _action$payload11.timeSliderCenterTime;
2472
+ var _action$payload10 = action.payload,
2473
+ mapId = _action$payload10.mapId,
2474
+ timeSliderCenterTime = _action$payload10.timeSliderCenterTime;
2315
2475
 
2316
2476
  if (!draft.byId[mapId]) {
2317
2477
  return;
@@ -2320,9 +2480,9 @@ var slice$3 = createSlice({
2320
2480
  draft.byId[mapId].timeSliderCenterTime = timeSliderCenterTime;
2321
2481
  },
2322
2482
  setTimeSliderUnfilteredSelectedTime: function setTimeSliderUnfilteredSelectedTime(draft, action) {
2323
- var _action$payload12 = action.payload,
2324
- mapId = _action$payload12.mapId,
2325
- timeSliderUnfilteredSelectedTime = _action$payload12.timeSliderUnfilteredSelectedTime;
2483
+ var _action$payload11 = action.payload,
2484
+ mapId = _action$payload11.mapId,
2485
+ timeSliderUnfilteredSelectedTime = _action$payload11.timeSliderUnfilteredSelectedTime;
2326
2486
 
2327
2487
  if (!draft.byId[mapId]) {
2328
2488
  return;
@@ -2331,9 +2491,9 @@ var slice$3 = createSlice({
2331
2491
  draft.byId[mapId].timeSliderUnfilteredSelectedTime = timeSliderUnfilteredSelectedTime;
2332
2492
  },
2333
2493
  setTimeSliderSecondsPerPx: function setTimeSliderSecondsPerPx(draft, action) {
2334
- var _action$payload13 = action.payload,
2335
- mapId = _action$payload13.mapId,
2336
- timeSliderSecondsPerPx = _action$payload13.timeSliderSecondsPerPx;
2494
+ var _action$payload12 = action.payload,
2495
+ mapId = _action$payload12.mapId,
2496
+ timeSliderSecondsPerPx = _action$payload12.timeSliderSecondsPerPx;
2337
2497
 
2338
2498
  if (!draft.byId[mapId]) {
2339
2499
  return;
@@ -2345,9 +2505,9 @@ var slice$3 = createSlice({
2345
2505
  draft.byId[mapId].timeSliderScale = scale;
2346
2506
  },
2347
2507
  setTimeSliderDataScaleToSecondsPerPx: function setTimeSliderDataScaleToSecondsPerPx(draft, action) {
2348
- var _action$payload14 = action.payload,
2349
- mapId = _action$payload14.mapId,
2350
- timeSliderDataScaleToSecondsPerPx = _action$payload14.timeSliderDataScaleToSecondsPerPx;
2508
+ var _action$payload13 = action.payload,
2509
+ mapId = _action$payload13.mapId,
2510
+ timeSliderDataScaleToSecondsPerPx = _action$payload13.timeSliderDataScaleToSecondsPerPx;
2351
2511
 
2352
2512
  if (!draft.byId[mapId]) {
2353
2513
  return;
@@ -2356,9 +2516,9 @@ var slice$3 = createSlice({
2356
2516
  draft.byId[mapId].timeSliderDataScaleToSecondsPerPx = timeSliderDataScaleToSecondsPerPx;
2357
2517
  },
2358
2518
  toggleAutoUpdate: function toggleAutoUpdate(draft, action) {
2359
- var _action$payload15 = action.payload,
2360
- mapId = _action$payload15.mapId,
2361
- shouldAutoUpdate = _action$payload15.shouldAutoUpdate;
2519
+ var _action$payload14 = action.payload,
2520
+ mapId = _action$payload14.mapId,
2521
+ shouldAutoUpdate = _action$payload14.shouldAutoUpdate;
2362
2522
 
2363
2523
  if (!draft.byId[mapId]) {
2364
2524
  return;
@@ -2367,9 +2527,9 @@ var slice$3 = createSlice({
2367
2527
  draft.byId[mapId].isAutoUpdating = shouldAutoUpdate;
2368
2528
  },
2369
2529
  toggleTimestepAuto: function toggleTimestepAuto(draft, action) {
2370
- var _action$payload16 = action.payload,
2371
- mapId = _action$payload16.mapId,
2372
- timestepAuto = _action$payload16.timestepAuto;
2530
+ var _action$payload15 = action.payload,
2531
+ mapId = _action$payload15.mapId,
2532
+ timestepAuto = _action$payload15.timestepAuto;
2373
2533
 
2374
2534
  if (!draft.byId[mapId]) {
2375
2535
  return;
@@ -2378,9 +2538,9 @@ var slice$3 = createSlice({
2378
2538
  draft.byId[mapId].isTimestepAuto = timestepAuto;
2379
2539
  },
2380
2540
  toggleTimeSliderHover: function toggleTimeSliderHover(draft, action) {
2381
- var _action$payload17 = action.payload,
2382
- mapId = _action$payload17.mapId,
2383
- isTimeSliderHoverOn = _action$payload17.isTimeSliderHoverOn;
2541
+ var _action$payload16 = action.payload,
2542
+ mapId = _action$payload16.mapId,
2543
+ isTimeSliderHoverOn = _action$payload16.isTimeSliderHoverOn;
2384
2544
 
2385
2545
  if (!draft.byId[mapId]) {
2386
2546
  return;
@@ -2389,9 +2549,9 @@ var slice$3 = createSlice({
2389
2549
  draft.byId[mapId].isTimeSliderHoverOn = isTimeSliderHoverOn;
2390
2550
  },
2391
2551
  toggleTimeSliderIsVisible: function toggleTimeSliderIsVisible(draft, action) {
2392
- var _action$payload18 = action.payload,
2393
- mapId = _action$payload18.mapId,
2394
- isTimeSliderVisible = _action$payload18.isTimeSliderVisible;
2552
+ var _action$payload17 = action.payload,
2553
+ mapId = _action$payload17.mapId,
2554
+ isTimeSliderVisible = _action$payload17.isTimeSliderVisible;
2395
2555
 
2396
2556
  if (!draft.byId[mapId]) {
2397
2557
  return;
@@ -2400,9 +2560,9 @@ var slice$3 = createSlice({
2400
2560
  draft.byId[mapId].isTimeSliderVisible = isTimeSliderVisible;
2401
2561
  },
2402
2562
  toggleZoomControls: function toggleZoomControls(draft, action) {
2403
- var _action$payload19 = action.payload,
2404
- mapId = _action$payload19.mapId,
2405
- shouldShowZoomControls = _action$payload19.shouldShowZoomControls;
2563
+ var _action$payload18 = action.payload,
2564
+ mapId = _action$payload18.mapId,
2565
+ shouldShowZoomControls = _action$payload18.shouldShowZoomControls;
2406
2566
 
2407
2567
  if (!draft.byId[mapId]) {
2408
2568
  return;
@@ -2411,9 +2571,9 @@ var slice$3 = createSlice({
2411
2571
  draft.byId[mapId].shouldShowZoomControls = shouldShowZoomControls;
2412
2572
  },
2413
2573
  setMapPinLocation: function setMapPinLocation(draft, action) {
2414
- var _action$payload20 = action.payload,
2415
- mapId = _action$payload20.mapId,
2416
- mapPinLocation = _action$payload20.mapPinLocation;
2574
+ var _action$payload19 = action.payload,
2575
+ mapId = _action$payload19.mapId,
2576
+ mapPinLocation = _action$payload19.mapPinLocation;
2417
2577
 
2418
2578
  if (!draft.byId[mapId]) {
2419
2579
  return;
@@ -2422,9 +2582,9 @@ var slice$3 = createSlice({
2422
2582
  draft.byId[mapId].mapPinLocation = mapPinLocation;
2423
2583
  },
2424
2584
  setDisableMapPin: function setDisableMapPin(draft, action) {
2425
- var _action$payload21 = action.payload,
2426
- mapId = _action$payload21.mapId,
2427
- disableMapPin = _action$payload21.disableMapPin;
2585
+ var _action$payload20 = action.payload,
2586
+ mapId = _action$payload20.mapId,
2587
+ disableMapPin = _action$payload20.disableMapPin;
2428
2588
 
2429
2589
  if (!draft.byId[mapId]) {
2430
2590
  return;
@@ -2433,57 +2593,22 @@ var slice$3 = createSlice({
2433
2593
  draft.byId[mapId].disableMapPin = disableMapPin;
2434
2594
  },
2435
2595
  toggleMapPinIsVisible: function toggleMapPinIsVisible(draft, action) {
2436
- var _action$payload22 = action.payload,
2437
- mapId = _action$payload22.mapId,
2438
- displayMapPin = _action$payload22.displayMapPin;
2596
+ var _action$payload21 = action.payload,
2597
+ mapId = _action$payload21.mapId,
2598
+ displayMapPin = _action$payload21.displayMapPin;
2439
2599
 
2440
2600
  if (!draft.byId[mapId]) {
2441
2601
  return;
2442
2602
  }
2443
2603
 
2444
2604
  draft.byId[mapId].displayMapPin = displayMapPin;
2445
- },
2446
- setActiveMapPresetId: function setActiveMapPresetId(draft, action) {
2447
- var _action$payload23 = action.payload,
2448
- mapId = _action$payload23.mapId,
2449
- presetId = _action$payload23.presetId;
2450
-
2451
- if (!draft.byId[mapId]) {
2452
- return;
2453
- }
2454
-
2455
- draft.byId[mapId].activeMapPresetId = presetId;
2456
- },
2457
- setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2458
- var _action$payload24 = action.payload,
2459
- mapId = _action$payload24.mapId,
2460
- hasChanges = _action$payload24.hasChanges;
2461
-
2462
- if (!draft.byId[mapId]) {
2463
- return;
2464
- }
2465
-
2466
- draft.byId[mapId].hasMapPresetChanges = hasChanges;
2467
- },
2468
- toggleDockedLayerManager: function toggleDockedLayerManager(draft, action) {
2469
- var _action$payload25 = action.payload,
2470
- mapId = _action$payload25.mapId,
2471
- openDockedLayerManager = _action$payload25.openDockedLayerManager;
2472
-
2473
- if (!draft.byId[mapId]) {
2474
- return;
2475
- }
2476
-
2477
- draft.byId[mapId].dockedLayerManager = {
2478
- isOpen: openDockedLayerManager
2479
- };
2480
2605
  }
2481
2606
  },
2482
2607
  extraReducers: function extraReducers(builder) {
2483
2608
  builder.addCase(addLayer$1, function (draft, action) {
2484
- var _action$payload26 = action.payload,
2485
- layerId = _action$payload26.layerId,
2486
- mapId = _action$payload26.mapId;
2609
+ var _action$payload22 = action.payload,
2610
+ layerId = _action$payload22.layerId,
2611
+ mapId = _action$payload22.mapId;
2487
2612
 
2488
2613
  if (!draft.byId[mapId]) {
2489
2614
  return;
@@ -2500,10 +2625,10 @@ var slice$3 = createSlice({
2500
2625
 
2501
2626
  draft.byId[mapId].mapLayers.unshift(layerId);
2502
2627
  }).addCase(addBaseLayer, function (draft, action) {
2503
- var _action$payload27 = action.payload,
2504
- layer = _action$payload27.layer,
2505
- layerId = _action$payload27.layerId,
2506
- mapId = _action$payload27.mapId;
2628
+ var _action$payload23 = action.payload,
2629
+ layer = _action$payload23.layer,
2630
+ layerId = _action$payload23.layerId,
2631
+ mapId = _action$payload23.mapId;
2507
2632
 
2508
2633
  if (!draft.byId[mapId]) {
2509
2634
  return;
@@ -2553,9 +2678,9 @@ var slice$3 = createSlice({
2553
2678
  }
2554
2679
  }
2555
2680
  }).addCase(setBaseLayers$1, function (draft, action) {
2556
- var _action$payload28 = action.payload,
2557
- layers = _action$payload28.layers,
2558
- mapId = _action$payload28.mapId; // Split into base and overlayers
2681
+ var _action$payload24 = action.payload,
2682
+ layers = _action$payload24.layers,
2683
+ mapId = _action$payload24.mapId; // Split into base and overlayers
2559
2684
 
2560
2685
  var baseLayers = [];
2561
2686
  var overLayers = [];
@@ -2582,9 +2707,9 @@ var slice$3 = createSlice({
2582
2707
  if (overLayerIds.length !== 0) draft.byId[mapId].overLayers = overLayerIds;
2583
2708
  }
2584
2709
  }).addCase(layerDelete$1, function (draft, action) {
2585
- var _action$payload29 = action.payload,
2586
- mapId = _action$payload29.mapId,
2587
- layerId = _action$payload29.layerId;
2710
+ var _action$payload25 = action.payload,
2711
+ mapId = _action$payload25.mapId,
2712
+ layerId = _action$payload25.layerId;
2588
2713
 
2589
2714
  if (!draft.byId[mapId]) {
2590
2715
  return;
@@ -2605,9 +2730,9 @@ var slice$3 = createSlice({
2605
2730
  draft.byId[mapId].activeLayerId = '';
2606
2731
  }
2607
2732
  }).addCase(baseLayerDelete, function (draft, action) {
2608
- var _action$payload30 = action.payload,
2609
- mapId = _action$payload30.mapId,
2610
- layerId = _action$payload30.layerId;
2733
+ var _action$payload26 = action.payload,
2734
+ mapId = _action$payload26.mapId,
2735
+ layerId = _action$payload26.layerId;
2611
2736
 
2612
2737
  if (!draft.byId[mapId]) {
2613
2738
  return;
@@ -2620,14 +2745,14 @@ var slice$3 = createSlice({
2620
2745
  return id !== layerId;
2621
2746
  });
2622
2747
  }).addCase(layerChangeDimension$1, function (draft, action) {
2623
- var _action$payload31 = action.payload,
2624
- layerId = _action$payload31.layerId,
2625
- dimension = _action$payload31.dimension;
2748
+ var _action$payload27 = action.payload,
2749
+ layerId = _action$payload27.layerId,
2750
+ dimension = _action$payload27.dimension;
2626
2751
  produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
2627
2752
  }).addCase(setTimeSync, function (draft, action) {
2628
- var _action$payload32 = action.payload,
2629
- targetsFromAction = _action$payload32.targets,
2630
- source = _action$payload32.source;
2753
+ var _action$payload28 = action.payload,
2754
+ targetsFromAction = _action$payload28.targets,
2755
+ source = _action$payload28.source;
2631
2756
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2632
2757
 
2633
2758
  var targets = [{
@@ -2651,9 +2776,9 @@ var slice$3 = createSlice({
2651
2776
  }
2652
2777
  });
2653
2778
  }).addCase(setBboxSync, function (draft, action) {
2654
- var _action$payload33 = action.payload,
2655
- targetsFromAction = _action$payload33.targets,
2656
- source = _action$payload33.source;
2779
+ var _action$payload29 = action.payload,
2780
+ targetsFromAction = _action$payload29.targets,
2781
+ source = _action$payload29.source;
2657
2782
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2658
2783
 
2659
2784
  var targets = [{
@@ -2684,9 +2809,9 @@ var slice$3 = createSlice({
2684
2809
  * These targets can be used as payloads in new Layer actions.
2685
2810
  * These actions are here handled via the layer reducer, as it is the same logic
2686
2811
  */
2687
- var _action$payload34 = action.payload,
2688
- targets = _action$payload34.targets,
2689
- source = _action$payload34.source;
2812
+ var _action$payload30 = action.payload,
2813
+ targets = _action$payload30.targets,
2814
+ source = _action$payload30.source;
2690
2815
  return targets.reduce(function (prevState, target) {
2691
2816
  var action = {
2692
2817
  payload: target,
@@ -2702,9 +2827,9 @@ var slice$3 = createSlice({
2702
2827
  var mapAction = mapActions$1.mapUpdateAllMapDimensions(mapDimensions);
2703
2828
  return reducer$3(draft, mapAction);
2704
2829
  }).addCase(mapChangeDimension, function (draft, action) {
2705
- var _action$payload35 = action.payload,
2706
- mapId = _action$payload35.mapId,
2707
- dimensionFromAction = _action$payload35.dimension;
2830
+ var _action$payload31 = action.payload,
2831
+ mapId = _action$payload31.mapId,
2832
+ dimensionFromAction = _action$payload31.dimension;
2708
2833
  produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
2709
2834
  }).addCase(setMapPreset, function (draft, action) {
2710
2835
  var mapId = action.payload.mapId;
@@ -2717,19 +2842,18 @@ var slice$3 = createSlice({
2717
2842
  draft.byId[mapId].baseLayers = [];
2718
2843
  draft.byId[mapId].mapLayers = [];
2719
2844
  draft.byId[mapId].overLayers = [];
2720
- draft.byId[mapId].hasMapPresetChanges = false;
2721
2845
  draft.byId[mapId].isAutoUpdating = false;
2722
2846
  draft.byId[mapId].isAnimating = false;
2723
2847
  draft.byId[mapId].isTimeSliderVisible = true;
2724
2848
  draft.byId[mapId].isTimestepAuto = true;
2725
2849
  draft.byId[mapId].displayMapPin = false;
2726
2850
  draft.byId[mapId].shouldShowZoomControls = true;
2727
- draft.byId[mapId].timeStep = defaultTimeStep;
2851
+ draft.byId[mapId].timeStep = undefined;
2728
2852
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2729
2853
  }).addCase(uiActions.registerDialog, function (draft, action) {
2730
- var _action$payload36 = action.payload,
2731
- mapId = _action$payload36.mapId,
2732
- type = _action$payload36.type;
2854
+ var _action$payload32 = action.payload,
2855
+ mapId = _action$payload32.mapId,
2856
+ type = _action$payload32.type;
2733
2857
 
2734
2858
  if (!draft.byId[mapId]) {
2735
2859
  return;
@@ -2841,7 +2965,7 @@ var getLayersByMapId = createSelector(getAllLayers, function (_store, _mapId) {
2841
2965
  * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
2842
2966
  */
2843
2967
 
2844
- createSelector(getAllLayers, function (layers) {
2968
+ var getLayers = createSelector(getAllLayers, function (layers) {
2845
2969
  return layers.filter(function (layer) {
2846
2970
  return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
2847
2971
  });
@@ -2854,7 +2978,7 @@ createSelector(getAllLayers, function (layers) {
2854
2978
  * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
2855
2979
  */
2856
2980
 
2857
- createSelector(getAllLayers, function (layers) {
2981
+ var getBaseLayers = createSelector(getAllLayers, function (layers) {
2858
2982
  return layers.filter(function (layer) {
2859
2983
  return layer.layerType === LayerType.baseLayer;
2860
2984
  });
@@ -2867,7 +2991,7 @@ createSelector(getAllLayers, function (layers) {
2867
2991
  * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
2868
2992
  */
2869
2993
 
2870
- createSelector(getAllLayers, function (layers) {
2994
+ var getOverLayers = createSelector(getAllLayers, function (layers) {
2871
2995
  return layers.filter(function (layer) {
2872
2996
  return layer.layerType === LayerType.overLayer;
2873
2997
  });
@@ -2996,7 +3120,7 @@ var getLayerStyle = createSelector(getLayerById, function (layer) {
2996
3120
  * @returns {string} returnType: LayerStatus
2997
3121
  */
2998
3122
 
2999
- createSelector(getLayerById, function (layer) {
3123
+ var getLayerStatus = createSelector(getLayerById, function (layer) {
3000
3124
  return layer && layer.status ? layer.status : LayerStatus["default"];
3001
3125
  });
3002
3126
  /**
@@ -3024,6 +3148,68 @@ var getAvailableBaseLayersForMap = createSelector(layerStore, function (_store,
3024
3148
 
3025
3149
  return [];
3026
3150
  }, selectorMemoizationOptions);
3151
+ /**
3152
+ * Returns the selected geojson feature for the given layer
3153
+ *
3154
+ * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
3155
+ * @param {object} store store: object - store object
3156
+ * @param {string} mapId layerId: string - Id of the layer
3157
+ * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
3158
+ */
3159
+
3160
+ var getSelectedFeatureIndex = createSelector(getLayerById, function (layer) {
3161
+ return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
3162
+ });
3163
+ /**
3164
+ * Gets layerIds that contain passed dimension
3165
+ *
3166
+ * Example: dimension = getDimensionLayerIds(store, 'elevation')
3167
+ * @param {object} store store: object - object from which the layers state will be extracted
3168
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3169
+ * @returns {string[]} returnType: string[] - layerIds
3170
+ */
3171
+
3172
+ var getDimensionLayerIds = createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
3173
+ return dimensionName;
3174
+ }, function (layerIds, layers, dimensionName) {
3175
+ return layerIds.reduce(function (list, layerId) {
3176
+ var layer = layers[layerId];
3177
+ var dimensions = (layer === null || layer === void 0 ? void 0 : layer.dimensions) ? layer.dimensions : [];
3178
+
3179
+ if (dimensions.find(function (dimension) {
3180
+ return dimension.name === dimensionName;
3181
+ })) {
3182
+ return list.concat(layerId);
3183
+ }
3184
+
3185
+ return list;
3186
+ }, []);
3187
+ }, selectorMemoizationOptions);
3188
+
3189
+ var selectors$2 = /*#__PURE__*/Object.freeze({
3190
+ __proto__: null,
3191
+ getLayerById: getLayerById,
3192
+ getLayersById: getLayersById,
3193
+ getLayersIds: getLayersIds,
3194
+ getAllLayers: getAllLayers,
3195
+ getLayersByMapId: getLayersByMapId,
3196
+ getLayers: getLayers,
3197
+ getBaseLayers: getBaseLayers,
3198
+ getOverLayers: getOverLayers,
3199
+ getLayerDimensions: getLayerDimensions,
3200
+ getLayerNonTimeDimensions: getLayerNonTimeDimensions,
3201
+ getLayerTimeDimension: getLayerTimeDimension,
3202
+ getLayerDimension: getLayerDimension,
3203
+ getLayerOpacity: getLayerOpacity,
3204
+ getLayerEnabled: getLayerEnabled,
3205
+ getLayerName: getLayerName,
3206
+ getLayerService: getLayerService,
3207
+ getLayerStyle: getLayerStyle,
3208
+ getLayerStatus: getLayerStatus,
3209
+ getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
3210
+ getSelectedFeatureIndex: getSelectedFeatureIndex,
3211
+ getDimensionLayerIds: getDimensionLayerIds
3212
+ });
3027
3213
 
3028
3214
  /* *
3029
3215
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3959,7 +4145,12 @@ var getMapTimeSliderScale = createSelector(getMapById, function (store) {
3959
4145
  */
3960
4146
 
3961
4147
  var getMapTimeStep = createSelector(getMapById, function (store) {
3962
- return store ? store.timeStep : defaultTimeStep;
4148
+ var _a;
4149
+
4150
+ return (_a = store === null || store === void 0 ? void 0 : store.timeStep) !== null && _a !== void 0 ? _a : defaultTimeStep;
4151
+ });
4152
+ var getMapTimeStepWithoutDefault = createSelector(getMapById, function (store) {
4153
+ return store === null || store === void 0 ? void 0 : store.timeStep;
3963
4154
  });
3964
4155
  /**
3965
4156
  * Returns the speed of animation
@@ -4190,56 +4381,32 @@ var getAllUniqueDimensions = createSelector(getAllMapIds, function (store) {
4190
4381
  * @returns {object} returnType: latitude and longitude of pin
4191
4382
  */
4192
4383
 
4193
- var getPinLocation = createSelector(getMapById, function (store) {
4194
- return store ? store.mapPinLocation : undefined;
4195
- }, selectorMemoizationOptions);
4196
- /**
4197
- * Returns the disable map pin boolean for the current map
4198
- *
4199
- * Example getDisableMapPin(store);
4200
- * @param {object} store store: object - store object
4201
- * @param {string} mapId mapId: string - Id of the map
4202
- * @returns {boolean} returnType: boolean
4203
- */
4204
-
4205
- var getDisableMapPin = createSelector(getMapById, function (store) {
4206
- return store ? store.disableMapPin : false;
4207
- });
4208
- /**
4209
- * Returns the diplay map pin boolean for the current map
4210
- *
4211
- * Example getDisplayMapPin(store);
4212
- * @param {object} store store: object - store object
4213
- * @param {string} mapId mapId: string - Id of the map
4214
- * @returns {boolean} returnType: boolean
4215
- */
4216
-
4217
- var getDisplayMapPin = createSelector(getMapById, function (store) {
4218
- return store ? store.displayMapPin : false;
4219
- });
4384
+ var getPinLocation = createSelector(getMapById, function (store) {
4385
+ return store ? store.mapPinLocation : undefined;
4386
+ }, selectorMemoizationOptions);
4220
4387
  /**
4221
- * Returns the selected geojson feature for the given map
4388
+ * Returns the disable map pin boolean for the current map
4222
4389
  *
4223
- * Example const selectedFeature = getSelectedFeature(store, 'mapId1')
4390
+ * Example getDisableMapPin(store);
4224
4391
  * @param {object} store store: object - store object
4225
4392
  * @param {string} mapId mapId: string - Id of the map
4226
- * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
4393
+ * @returns {boolean} returnType: boolean
4227
4394
  */
4228
4395
 
4229
- var getSelectedFeatureIndex = createSelector(getMapById, function (store) {
4230
- return store === null || store === void 0 ? void 0 : store.selectedFeatureIndex;
4396
+ var getDisableMapPin = createSelector(getMapById, function (store) {
4397
+ return store ? store.disableMapPin : false;
4231
4398
  });
4232
4399
  /**
4233
- * Returns the active map preset id
4400
+ * Returns the display map pin boolean for the current map
4234
4401
  *
4235
- * Example getActiveMapPresetId(store, mapId);
4402
+ * Example getDisplayMapPin(store);
4236
4403
  * @param {object} store store: object - store object
4237
4404
  * @param {string} mapId mapId: string - Id of the map
4238
- * @returns {boolean} returnType: boolean or undefined
4405
+ * @returns {boolean} returnType: boolean
4239
4406
  */
4240
4407
 
4241
- var getActiveMapPresetId = createSelector(getMapById, function (store) {
4242
- return store ? store.activeMapPresetId : undefined;
4408
+ var getDisplayMapPin = createSelector(getMapById, function (store) {
4409
+ return store ? store.displayMapPin : false;
4243
4410
  });
4244
4411
  /**
4245
4412
  * Returns the legend id
@@ -4305,31 +4472,40 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
4305
4472
  });
4306
4473
  }, selectorMemoizationOptions);
4307
4474
  /**
4308
- * Returns the has changes state of the map preset
4475
+ * Gets all enabled layerIds for map
4309
4476
  *
4310
- * Example getHasMapPresetChanges(store, mapId);
4311
- * @param {object} store store: object - store object
4477
+ * Example: getMapLayerIdsEnabled = getLayerIdsEnabled(store, 'mapId_1')
4478
+ * @param {object} store store: object - store
4312
4479
  * @param {string} mapId mapId: string - Id of the map
4313
- * @returns {boolean} returnType: boolean
4480
+ * @returns {string[]} returnType: string[] - array of enabled layerIds
4314
4481
  */
4315
4482
 
4316
- var getHasMapPresetChanges = createSelector(getMapById, function (store) {
4317
- return store && store.hasMapPresetChanges ? store.hasMapPresetChanges : false;
4318
- });
4483
+ var getMapLayerIdsEnabled = createSelector(getLayerIds, getLayersById, function (mapLayerIds, layers) {
4484
+ return mapLayerIds.reduce(function (list, layerId) {
4485
+ if (layers[layerId] && layers[layerId].enabled) {
4486
+ return list.concat(layerId);
4487
+ }
4488
+
4489
+ return list;
4490
+ }, []);
4491
+ }, selectorMemoizationOptions);
4319
4492
  /**
4320
- * Returns whether the docked layer manager is open
4493
+ * Returns if a map dimension is used for any enabled layers on that map
4321
4494
  *
4322
- * Example getIsDockedLayerManagerOpen(store, mapId);
4495
+ * Example getIsEnabledLayersForMapDimension(store, mapId);
4323
4496
  * @param {object} store store: object - store object
4324
4497
  * @param {string} mapId mapId: string - Id of the map
4498
+ * @param {string} dimensionName dimensionName: string - name of the dimension
4325
4499
  * @returns {Boolean} returnType: boolean
4326
4500
  */
4327
4501
 
4328
- var getIsDockedLayerManagerOpen = createSelector(getMapById, function (store) {
4329
- var _a;
4330
-
4331
- return (_a = store === null || store === void 0 ? void 0 : store.dockedLayerManager) === null || _a === void 0 ? void 0 : _a.isOpen;
4332
- });
4502
+ var getIsEnabledLayersForMapDimension = createSelector(getMapLayerIdsEnabled, function (store, _mapId, dimensionName) {
4503
+ return getDimensionLayerIds(store, dimensionName);
4504
+ }, function (enabledMapLayerIds, dimensionLayerIds) {
4505
+ return dimensionLayerIds.some(function (layerId) {
4506
+ return enabledMapLayerIds.includes(layerId);
4507
+ });
4508
+ }, selectorMemoizationOptions);
4333
4509
 
4334
4510
  var selectors = /*#__PURE__*/Object.freeze({
4335
4511
  __proto__: null,
@@ -4356,6 +4532,7 @@ var selectors = /*#__PURE__*/Object.freeze({
4356
4532
  getActiveLayerId: getActiveLayerId,
4357
4533
  getMapTimeSliderScale: getMapTimeSliderScale,
4358
4534
  getMapTimeStep: getMapTimeStep,
4535
+ getMapTimeStepWithoutDefault: getMapTimeStepWithoutDefault,
4359
4536
  getMapAnimationDelay: getMapAnimationDelay,
4360
4537
  getMapTimeSliderCenterTime: getMapTimeSliderCenterTime,
4361
4538
  getTimeSliderUnfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime,
@@ -4374,12 +4551,10 @@ var selectors = /*#__PURE__*/Object.freeze({
4374
4551
  getPinLocation: getPinLocation,
4375
4552
  getDisableMapPin: getDisableMapPin,
4376
4553
  getDisplayMapPin: getDisplayMapPin,
4377
- getSelectedFeatureIndex: getSelectedFeatureIndex,
4378
- getActiveMapPresetId: getActiveMapPresetId,
4379
4554
  getLegendId: getLegendId,
4380
4555
  getMapPreset: getMapPreset,
4381
- getHasMapPresetChanges: getHasMapPresetChanges,
4382
- getIsDockedLayerManagerOpen: getIsDockedLayerManagerOpen
4556
+ getMapLayerIdsEnabled: getMapLayerIdsEnabled,
4557
+ getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension
4383
4558
  });
4384
4559
 
4385
4560
  var DialogTypes;
@@ -4394,6 +4569,7 @@ var DialogTypes;
4394
4569
  DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4395
4570
  DialogTypes["LayerManager"] = "layerManager";
4396
4571
  DialogTypes["LayerSelect"] = "layerSelect";
4572
+ DialogTypes["DockedLayerManager"] = "dockedLayerManager";
4397
4573
  })(DialogTypes || (DialogTypes = {}));
4398
4574
 
4399
4575
  var types = /*#__PURE__*/Object.freeze({
@@ -7682,9 +7858,8 @@ var _marked$2 = /*#__PURE__*/regeneratorRuntime.mark(startAnimationSaga),
7682
7858
  _marked6 = /*#__PURE__*/regeneratorRuntime.mark(toggleAutoUpdateSaga),
7683
7859
  _marked7 = /*#__PURE__*/regeneratorRuntime.mark(handleBaseLayersSaga),
7684
7860
  _marked8 = /*#__PURE__*/regeneratorRuntime.mark(setMapPresetSaga),
7685
- _marked9 = /*#__PURE__*/regeneratorRuntime.mark(checkMapPresetForChangesSaga),
7686
- _marked10 = /*#__PURE__*/regeneratorRuntime.mark(unregisterMapSaga),
7687
- _marked11 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7861
+ _marked9 = /*#__PURE__*/regeneratorRuntime.mark(unregisterMapSaga),
7862
+ _marked10 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7688
7863
 
7689
7864
  var generateTimeList = function generateTimeList(start, end, interval) {
7690
7865
  var timeList = [];
@@ -7853,7 +8028,7 @@ function updateAnimation(mapId, maxValue) {
7853
8028
  }, _marked4$1);
7854
8029
  }
7855
8030
  function setLayerDimensionsSaga(_ref4) {
7856
- var payload, layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance;
8031
+ var payload, layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, isActiveLayer, timeStep, newTimeStep;
7857
8032
  return regeneratorRuntime.wrap(function setLayerDimensionsSaga$(_context5) {
7858
8033
  while (1) {
7859
8034
  switch (_context5.prev = _context5.next) {
@@ -7910,19 +8085,44 @@ function setLayerDimensionsSaga(_ref4) {
7910
8085
  case 24:
7911
8086
  isAnimating$1 = _context5.sent;
7912
8087
  webmapInstance = getWMJSMapById(mapId);
8088
+ isActiveLayer = layerId === activeLayerId;
8089
+ _context5.next = 29;
8090
+ return select(getMapTimeStepWithoutDefault, mapId);
8091
+
8092
+ case 29:
8093
+ timeStep = _context5.sent;
8094
+
8095
+ if (!(isActiveLayer && timeStep === undefined && newTimeDimension)) {
8096
+ _context5.next = 35;
8097
+ break;
8098
+ }
8099
+
8100
+ newTimeStep = getActiveLayerTimeStep(newTimeDimension);
8101
+
8102
+ if (!newTimeStep) {
8103
+ _context5.next = 35;
8104
+ break;
8105
+ }
8106
+
8107
+ _context5.next = 35;
8108
+ return put(mapActions$1.setTimeStep({
8109
+ mapId: mapId,
8110
+ timeStep: newTimeStep
8111
+ }));
7913
8112
 
7914
- if (!(layerId === activeLayerId && // only update the active layer
8113
+ case 35:
8114
+ if (!(isActiveLayer && // only update the active layer
7915
8115
  shouldAutoUpdate && newTimeDimension && newTimeDimension.maxValue && prevTimeDimension && prevTimeDimension.currentValue && prevTimeDimension.currentValue !== newTimeDimension.maxValue)) {
7916
- _context5.next = 34;
8116
+ _context5.next = 43;
7917
8117
  break;
7918
8118
  }
7919
8119
 
7920
8120
  if (isAnimating$1) {
7921
- _context5.next = 30;
8121
+ _context5.next = 39;
7922
8122
  break;
7923
8123
  }
7924
8124
 
7925
- _context5.next = 30;
8125
+ _context5.next = 39;
7926
8126
  return put(layerActions.layerChangeDimension({
7927
8127
  layerId: layerId,
7928
8128
  origin: LayerActionOrigin.setLayerDimensionSaga,
@@ -7932,39 +8132,39 @@ function setLayerDimensionsSaga(_ref4) {
7932
8132
  }
7933
8133
  }));
7934
8134
 
7935
- case 30:
7936
- _context5.next = 32;
8135
+ case 39:
8136
+ _context5.next = 41;
7937
8137
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
7938
8138
 
7939
- case 32:
7940
- _context5.next = 37;
8139
+ case 41:
8140
+ _context5.next = 46;
7941
8141
  break;
7942
8142
 
7943
- case 34:
8143
+ case 43:
7944
8144
  if (!(isAnimating$1 && !webmapInstance.isAnimating && newTimeDimension && newTimeDimension.maxValue)) {
7945
- _context5.next = 37;
8145
+ _context5.next = 46;
7946
8146
  break;
7947
8147
  }
7948
8148
 
7949
- _context5.next = 37;
8149
+ _context5.next = 46;
7950
8150
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
7951
8151
 
7952
- case 37:
7953
- _context5.next = 42;
8152
+ case 46:
8153
+ _context5.next = 51;
7954
8154
  break;
7955
8155
 
7956
- case 39:
7957
- _context5.prev = 39;
8156
+ case 48:
8157
+ _context5.prev = 48;
7958
8158
  _context5.t0 = _context5["catch"](1);
7959
8159
  // eslint-disable-next-line no-console
7960
8160
  console.warn(_context5.t0);
7961
8161
 
7962
- case 42:
8162
+ case 51:
7963
8163
  case "end":
7964
8164
  return _context5.stop();
7965
8165
  }
7966
8166
  }
7967
- }, _marked5, null, [[1, 39]]);
8167
+ }, _marked5, null, [[1, 48]]);
7968
8168
  }
7969
8169
  function toggleAutoUpdateSaga(_ref5) {
7970
8170
  var payload, shouldAutoUpdate, mapId, layerId, timeDimension;
@@ -8310,70 +8510,20 @@ function setMapPresetSaga(_ref6) {
8310
8510
  }
8311
8511
  }, _marked8, null, [[1, 66]]);
8312
8512
  }
8313
- var mapPresetChangeActions = [layerActions.setBaseLayers.type, layerActions.layerDelete.type, layerActions.addLayer.type, layerActions.layerChangeEnabled.type, layerActions.layerChangeName.type, layerActions.layerChangeStyle.type, layerActions.layerChangeOpacity.type, layerActions.layerChangeDimension.type, mapActions$1.layerMoveLayer.type, mapActions$1.setActiveLayerId.type, mapActions$1.toggleAutoUpdate, mapActions$1.mapStartAnimation, mapActions$1.mapStopAnimation, mapActions$1.toggleTimeSliderIsVisible, mapActions$1.setTimeStep, mapActions$1.setAnimationDelay, mapActions$1.toggleTimestepAuto, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox.type];
8314
- var supportedChangeOrigins = [LayerActionOrigin.layerManager, LayerActionOrigin.wmsLoader, MapActionOrigin.map];
8315
- function checkMapPresetForChangesSaga(action) {
8316
- var _action$payload, mapId, origin, isChangeOriginSupported, hasMapPresetChanges;
8317
-
8318
- return regeneratorRuntime.wrap(function checkMapPresetForChangesSaga$(_context9) {
8319
- while (1) {
8320
- switch (_context9.prev = _context9.next) {
8321
- case 0:
8322
- _action$payload = action.payload, mapId = _action$payload.mapId, origin = _action$payload.origin;
8323
-
8324
- if (origin) {
8325
- _context9.next = 3;
8326
- break;
8327
- }
8328
-
8329
- return _context9.abrupt("return");
8330
-
8331
- case 3:
8332
- isChangeOriginSupported = supportedChangeOrigins.indexOf(origin) >= 0;
8333
-
8334
- if (!isChangeOriginSupported) {
8335
- _context9.next = 11;
8336
- break;
8337
- }
8338
-
8339
- _context9.next = 7;
8340
- return select(getHasMapPresetChanges, mapId);
8341
-
8342
- case 7:
8343
- hasMapPresetChanges = _context9.sent;
8344
-
8345
- if (hasMapPresetChanges) {
8346
- _context9.next = 11;
8347
- break;
8348
- }
8349
-
8350
- _context9.next = 11;
8351
- return put(mapActions$1.setHasMapPresetChanges({
8352
- mapId: mapId,
8353
- hasChanges: true
8354
- }));
8355
-
8356
- case 11:
8357
- case "end":
8358
- return _context9.stop();
8359
- }
8360
- }
8361
- }, _marked9);
8362
- }
8363
8513
  function unregisterMapSaga(_ref7) {
8364
8514
  var payload, mapId, layerList;
8365
- return regeneratorRuntime.wrap(function unregisterMapSaga$(_context10) {
8515
+ return regeneratorRuntime.wrap(function unregisterMapSaga$(_context9) {
8366
8516
  while (1) {
8367
- switch (_context10.prev = _context10.next) {
8517
+ switch (_context9.prev = _context9.next) {
8368
8518
  case 0:
8369
8519
  payload = _ref7.payload;
8370
8520
  mapId = payload.mapId;
8371
- _context10.next = 4;
8521
+ _context9.next = 4;
8372
8522
  return select(getLayersByMapId, mapId);
8373
8523
 
8374
8524
  case 4:
8375
- layerList = _context10.sent;
8376
- _context10.next = 7;
8525
+ layerList = _context9.sent;
8526
+ _context9.next = 7;
8377
8527
  return all(layerList.map(function (layer) {
8378
8528
  return put(layerActions.layerDelete({
8379
8529
  mapId: mapId,
@@ -8385,55 +8535,49 @@ function unregisterMapSaga(_ref7) {
8385
8535
 
8386
8536
  case 7:
8387
8537
  case "end":
8388
- return _context10.stop();
8538
+ return _context9.stop();
8389
8539
  }
8390
8540
  }
8391
- }, _marked10);
8541
+ }, _marked9);
8392
8542
  }
8393
8543
  function rootSaga$2() {
8394
- return regeneratorRuntime.wrap(function rootSaga$(_context11) {
8544
+ return regeneratorRuntime.wrap(function rootSaga$(_context10) {
8395
8545
  while (1) {
8396
- switch (_context11.prev = _context11.next) {
8546
+ switch (_context10.prev = _context10.next) {
8397
8547
  case 0:
8398
- _context11.next = 2;
8399
- return all([takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga), takeLatest(mapActions$1.setActiveMapPresetId.type, stopAnimationSaga)]);
8548
+ _context10.next = 2;
8549
+ return takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga);
8400
8550
 
8401
8551
  case 2:
8402
- _context11.next = 4;
8552
+ _context10.next = 4;
8403
8553
  return takeLatest(mapActions$1.mapStartAnimation.type, startAnimationSaga);
8404
8554
 
8405
8555
  case 4:
8406
- _context11.next = 6;
8556
+ _context10.next = 6;
8407
8557
  return takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
8408
8558
 
8409
8559
  case 6:
8410
- _context11.next = 8;
8560
+ _context10.next = 8;
8411
8561
  return takeLatest(layerActions.onUpdateLayerInformation.type, setLayerDimensionsSaga);
8412
8562
 
8413
8563
  case 8:
8414
- _context11.next = 10;
8564
+ _context10.next = 10;
8415
8565
  return takeLatest(mapActions$1.toggleAutoUpdate.type, toggleAutoUpdateSaga);
8416
8566
 
8417
8567
  case 10:
8418
- _context11.next = 12;
8568
+ _context10.next = 12;
8419
8569
  return takeEvery(mapActions$1.setMapPreset.type, setMapPresetSaga);
8420
8570
 
8421
8571
  case 12:
8422
- _context11.next = 14;
8423
- return all(mapPresetChangeActions.map(function (action) {
8424
- return takeEvery(action, checkMapPresetForChangesSaga);
8425
- }));
8426
-
8427
- case 14:
8428
- _context11.next = 16;
8572
+ _context10.next = 14;
8429
8573
  return takeEvery(mapActions$1.unregisterMap.type, unregisterMapSaga);
8430
8574
 
8431
- case 16:
8575
+ case 14:
8432
8576
  case "end":
8433
- return _context11.stop();
8577
+ return _context10.stop();
8434
8578
  }
8435
8579
  }
8436
- }, _marked11);
8580
+ }, _marked10);
8437
8581
  }
8438
8582
 
8439
8583
  var moduleConfig = {
@@ -11977,7 +12121,6 @@ var LayerManager = function LayerManager(_ref) {
11977
12121
  }));
11978
12122
  }
11979
12123
  }),
11980
- hasElevation: !isDockedLayerManager,
11981
12124
  className: "layermanager",
11982
12125
  sx: layerManagerStyle,
11983
12126
  onResizeStop: function onResizeStop(_event, _direction, node) {
@@ -12048,6 +12191,7 @@ var LayerManager = function LayerManager(_ref) {
12048
12191
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12049
12192
  * */
12050
12193
  var useSetupDialog = function useSetupDialog(dialogType) {
12194
+ var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'app';
12051
12195
  var dispatch = useDispatch();
12052
12196
  var onCloseDialog = useCallback(function () {
12053
12197
  dispatch(uiActions.setToggleOpenDialog({
@@ -12070,9 +12214,10 @@ var useSetupDialog = function useSetupDialog(dialogType) {
12070
12214
  var registerDialog = useCallback(function () {
12071
12215
  dispatch(uiActions.registerDialog({
12072
12216
  type: dialogType,
12073
- setOpen: false
12217
+ setOpen: false,
12218
+ source: source
12074
12219
  }));
12075
- }, [dialogType, dispatch]);
12220
+ }, [dialogType, dispatch, source]);
12076
12221
  var unregisterDialog = useCallback(function () {
12077
12222
  dispatch(uiActions.unregisterDialog({
12078
12223
  type: dialogType
@@ -12238,9 +12383,9 @@ var LayerManagerConnect = function LayerManagerConnect(_ref) {
12238
12383
  var onToggleDock = function onToggleDock() {
12239
12384
  // Close the floating layer manager and open docked layer manager
12240
12385
  onCloseDialog();
12241
- dispatch(mapActions$1.toggleDockedLayerManager({
12242
- mapId: mapId,
12243
- openDockedLayerManager: true
12386
+ dispatch(uiActions.setToggleOpenDialog({
12387
+ type: "".concat(DialogTypes.DockedLayerManager, "-").concat(mapId),
12388
+ setOpen: true
12244
12389
  }));
12245
12390
  };
12246
12391
 
@@ -12294,7 +12439,9 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12294
12439
  _ref$showTitle = _ref.showTitle,
12295
12440
  showTitle = _ref$showTitle === void 0 ? false : _ref$showTitle,
12296
12441
  _ref$leftHeaderCompon = _ref.leftHeaderComponent,
12297
- leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? undefined : _ref$leftHeaderCompon;
12442
+ leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? undefined : _ref$leftHeaderCompon,
12443
+ _ref$source = _ref.source,
12444
+ source = _ref$source === void 0 ? 'app' : _ref$source;
12298
12445
  var dispatch = useDispatch(); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12299
12446
  // const isMapPresetLoading = useSelector((store: AppStore) =>
12300
12447
  // mapSelectors.getIsMapPresetLoading(store, mapId),
@@ -12303,26 +12450,22 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12303
12450
  // mapSelectors.getMapPresetError(store, mapId),
12304
12451
  // );
12305
12452
 
12306
- var isDockedLayerManagerOpen = useSelector(function (store) {
12307
- return getIsDockedLayerManagerOpen(store, mapId);
12308
- });
12453
+ var dialogType = "".concat(DialogTypes.DockedLayerManager, "-").concat(mapId);
12309
12454
 
12310
- var onClose = function onClose() {
12311
- // Open docked layer manager and close the floating layer manager
12312
- dispatch(mapActions$1.toggleDockedLayerManager({
12313
- mapId: mapId,
12314
- openDockedLayerManager: false
12315
- }));
12316
- };
12455
+ var _useSetupDialog = useSetupDialog(dialogType, source),
12456
+ dialogOrder = _useSetupDialog.dialogOrder,
12457
+ isDialogOpen = _useSetupDialog.isDialogOpen,
12458
+ setDialogOrder = _useSetupDialog.setDialogOrder,
12459
+ onCloseDialog = _useSetupDialog.onCloseDialog;
12317
12460
 
12318
12461
  var onToggleDock = function onToggleDock() {
12319
12462
  // Close docked layer manager and open the floating layer manager
12320
- onClose();
12463
+ onCloseDialog();
12321
12464
  dispatch(uiActions.setActiveMapIdForDialog({
12322
12465
  type: DialogTypes.LayerManager,
12323
12466
  mapId: mapId,
12324
12467
  setOpen: true,
12325
- source: 'app'
12468
+ source: source
12326
12469
  }));
12327
12470
  };
12328
12471
 
@@ -12331,8 +12474,8 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12331
12474
  preloadedAvailableBaseLayers: preloadedAvailableBaseLayers,
12332
12475
  preloadedBaseServices: preloadedBaseServices,
12333
12476
  bounds: bounds,
12334
- isOpen: isDockedLayerManagerOpen,
12335
- onClose: onClose,
12477
+ isOpen: isDialogOpen,
12478
+ onClose: onCloseDialog,
12336
12479
  showTitle: showTitle,
12337
12480
  leftHeaderComponent: leftHeaderComponent,
12338
12481
  // isLoading={isMapPresetLoading}
@@ -12343,7 +12486,10 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12343
12486
  startPosition: {
12344
12487
  top: 60,
12345
12488
  right: 16
12346
- }
12489
+ },
12490
+ onMouseDown: setDialogOrder,
12491
+ order: dialogOrder,
12492
+ source: source
12347
12493
  });
12348
12494
  };
12349
12495
 
@@ -15671,8 +15817,8 @@ var DimensionSelectDialogConnect = function DimensionSelectDialogConnect(_ref) {
15671
15817
  _ref$source = _ref.source,
15672
15818
  source = _ref$source === void 0 ? 'app' : _ref$source;
15673
15819
  var dispatch = useDispatch();
15674
- var mapDimension = useSelector(function (store) {
15675
- return getMapDimension(store, mapId, dimensionName);
15820
+ var mapContainsDimension = useSelector(function (store) {
15821
+ return getIsEnabledLayersForMapDimension(store, mapId, dimensionName);
15676
15822
  });
15677
15823
  var layerIds = useSelector(function (store) {
15678
15824
  return getLayerIds(store, mapId);
@@ -15700,7 +15846,7 @@ var DimensionSelectDialogConnect = function DimensionSelectDialogConnect(_ref) {
15700
15846
  }));
15701
15847
  }, [dispatch]);
15702
15848
 
15703
- if (!mapDimension || !layerIds || layerIds.length < 1) {
15849
+ if (!mapContainsDimension || !layerIds || layerIds.length < 1) {
15704
15850
  return null;
15705
15851
  }
15706
15852
 
@@ -15820,6 +15966,10 @@ var DimensionSelectMapButtonConnect = function DimensionSelectMapButtonConnect(_
15820
15966
  });
15821
15967
  var isOpenInStore = useSelector(function (store) {
15822
15968
  return getisDialogOpen(store, uiDialogType);
15969
+ }); // Only show button if enabled layer for map contains dimension
15970
+
15971
+ var mapContainsDimension = useSelector(function (store) {
15972
+ return getIsEnabledLayersForMapDimension(store, mapId, dimension);
15823
15973
  });
15824
15974
  var openMultiDimensionDialog = React.useCallback(function () {
15825
15975
  var setOpen = currentActiveMapId !== mapId ? true : !isOpenInStore;
@@ -15830,6 +15980,11 @@ var DimensionSelectMapButtonConnect = function DimensionSelectMapButtonConnect(_
15830
15980
  source: source
15831
15981
  }));
15832
15982
  }, [currentActiveMapId, dispatch, isOpenInStore, uiDialogType, mapId, source]);
15983
+
15984
+ if (!mapContainsDimension) {
15985
+ return null;
15986
+ }
15987
+
15833
15988
  var isOpen = currentActiveMapId === mapId && isOpenInStore;
15834
15989
  return /*#__PURE__*/React.createElement(DimensionSelectButton, {
15835
15990
  dimension: dimension,
@@ -15973,7 +16128,8 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
15973
16128
  title = _ref.title,
15974
16129
  icon = _ref.icon,
15975
16130
  _ref$onChangeMouseWhe = _ref.onChangeMouseWheel,
15976
- onChangeMouseWheel = _ref$onChangeMouseWhe === void 0 ? function () {} : _ref$onChangeMouseWhe;
16131
+ onChangeMouseWheel = _ref$onChangeMouseWhe === void 0 ? function () {} : _ref$onChangeMouseWhe,
16132
+ animationLength = _ref.animationLength;
15977
16133
  var currentMarkIndex = marks.findIndex(function (mark) {
15978
16134
  return mark.value === value;
15979
16135
  });
@@ -16065,7 +16221,22 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16065
16221
  },
16066
16222
  selected: isAutoSelected,
16067
16223
  disabled: isDisabled
16068
- }, "Auto")));
16224
+ }, "Auto"), animationLength && /*#__PURE__*/React.createElement(MenuItem, {
16225
+ disabled: true,
16226
+ sx: {
16227
+ fontSize: '12px',
16228
+ opacity: 0.67,
16229
+ padding: '0px 12px',
16230
+ '&.MuiMenuItem-root': {
16231
+ minHeight: '30px!important'
16232
+ }
16233
+ }
16234
+ }, "length"), animationLength && /*#__PURE__*/React.createElement(ToolButton, {
16235
+ "data-testid": "menu-animation-length-button",
16236
+ active: false,
16237
+ disableRipple: true,
16238
+ width: "100%"
16239
+ }, minutesToDescribedDuration(animationLength))));
16069
16240
  };
16070
16241
 
16071
16242
  var speedTooltipTitle = 'Speed';
@@ -16208,8 +16379,7 @@ var TimeStepButton = function TimeStepButton(_ref) {
16208
16379
  var timeStep = _ref.timeStep,
16209
16380
  _ref$disabled = _ref.disabled,
16210
16381
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16211
- _ref$isTimestepAuto = _ref.isTimestepAuto,
16212
- isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto,
16382
+ isTimestepAuto = _ref.isTimestepAuto,
16213
16383
  onChangeTimeStep = _ref.onChangeTimeStep,
16214
16384
  _ref$onToggleTimestep = _ref.onToggleTimestepAuto,
16215
16385
  onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
@@ -16418,6 +16588,7 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16418
16588
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16419
16589
  _ref$animationLength = _ref.animationLength,
16420
16590
  animationLength = _ref$animationLength === void 0 ? AnimationLength.Hours1 : _ref$animationLength,
16591
+ animationLengthInMinutes = _ref.animationLengthInMinutes,
16421
16592
  onChangeAnimationLength = _ref.onChangeAnimationLength;
16422
16593
 
16423
16594
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -16436,7 +16607,8 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16436
16607
  title: title,
16437
16608
  isDisabled: disabled,
16438
16609
  value: animationLength,
16439
- onChangeMouseWheel: onChangeSliderValue
16610
+ onChangeMouseWheel: onChangeSliderValue,
16611
+ animationLength: animationLengthInMinutes
16440
16612
  });
16441
16613
  };
16442
16614
 
@@ -16485,7 +16657,8 @@ var OptionsMenu = function OptionsMenu(_ref) {
16485
16657
  xs: "auto"
16486
16658
  }, timeStepBtn || /*#__PURE__*/React__default.createElement(TimeStepButton, {
16487
16659
  timeStep: 0,
16488
- onChangeTimeStep: function onChangeTimeStep() {}
16660
+ onChangeTimeStep: function onChangeTimeStep() {},
16661
+ isTimestepAuto: false
16489
16662
  })), /*#__PURE__*/React__default.createElement(Grid, {
16490
16663
  item: true,
16491
16664
  xs: "auto"
@@ -16506,12 +16679,7 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16506
16679
  timeScaleBtn = _ref.timeScaleBtn,
16507
16680
  animationLengthBtn = _ref.animationLengthBtn,
16508
16681
  _ref$isOpenByDefault = _ref.isOpenByDefault,
16509
- isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault,
16510
- timeStep = _ref.timeStep,
16511
- timeDimension = _ref.timeDimension,
16512
- onChangeTimeStep = _ref.onChangeTimeStep,
16513
- _ref$isTimestepAuto = _ref.isTimestepAuto,
16514
- isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto;
16682
+ isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
16515
16683
 
16516
16684
  var _useState = useState(null),
16517
16685
  _useState2 = _slicedToArray(_useState, 2),
@@ -16528,12 +16696,6 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16528
16696
  setOpen(true);
16529
16697
  }
16530
16698
  }, [anchorEl, isOpenByDefault]);
16531
- var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
16532
- React__default.useEffect(function () {
16533
- if (isTimestepAuto) {
16534
- onChangeTimeStep(timeStepFromLayer);
16535
- }
16536
- }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
16537
16699
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(CustomTooltip, {
16538
16700
  title: "Animation options",
16539
16701
  placement: "bottom"
@@ -17530,11 +17692,155 @@ var isInsideAnimationArea = function isInsideAnimationArea(x, leftMarkerPx, righ
17530
17692
  * @returns
17531
17693
  */
17532
17694
 
17533
- var isLeftAnimationIconArea = function isLeftAnimationIconArea(x, leftMarkerPx, width) {
17534
- return x >= leftMarkerPx && x <= leftMarkerPx + width;
17535
- };
17695
+ var isLeftAnimationIconArea = function isLeftAnimationIconArea(x, leftMarkerPx, width) {
17696
+ return x >= leftMarkerPx && x <= leftMarkerPx + width;
17697
+ };
17698
+
17699
+ var TIME_SLIDER_LEGEND_HEIGHT = 24;
17700
+ var DRAG_AREA_WIDTH = 24;
17701
+
17702
+ function useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition) {
17703
+ var _React$useState = React.useState(convertStringTimeToUnix(animationStartTime)),
17704
+ _React$useState2 = _slicedToArray(_React$useState, 2),
17705
+ localAnimationStartTime = _React$useState2[0],
17706
+ setLocalAnimationStartTime = _React$useState2[1];
17707
+
17708
+ var _React$useState3 = React.useState(convertStringTimeToUnix(animationEndTime)),
17709
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
17710
+ localAnimationEndTime = _React$useState4[0],
17711
+ setLocalAnimationEndTime = _React$useState4[1];
17712
+
17713
+ React.useEffect(function () {
17714
+ setLocalAnimationStartTime(convertStringTimeToUnix(animationStartTime));
17715
+ setLocalAnimationEndTime(convertStringTimeToUnix(animationEndTime));
17716
+ }, [animationStartTime, animationEndTime]);
17717
+ var animationDiff = React.useRef();
17718
+ var pixelsMovedSinceStartDragging = React.useRef(0);
17719
+ React.useEffect(function () {
17720
+ var handleMouseUp = function handleMouseUp() {
17721
+ pixelsMovedSinceStartDragging.current = 0;
17722
+ animationDiff.current = undefined;
17723
+ };
17724
+
17725
+ document.addEventListener('mouseup', handleMouseUp);
17726
+ return function () {
17727
+ document.removeEventListener('mouseup', handleMouseUp);
17728
+ };
17729
+ }, []);
17730
+ React.useEffect(function () {
17731
+ var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
17732
+
17733
+ if (stoppedDragging) {
17734
+ if (localAnimationStartTime && localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
17735
+ onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17736
+ }
17737
+
17738
+ if (localAnimationEndTime && localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
17739
+ onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17740
+ }
17741
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
17742
+
17743
+ }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
17744
+ var handleAnimationDragging = useCallback(function (x) {
17745
+ if (!localAnimationStartTime || !localAnimationEndTime) return;
17746
+
17747
+ var _map = [localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
17748
+ return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
17749
+ }),
17750
+ _map2 = _slicedToArray(_map, 2),
17751
+ leftMarkerPx = _map2[0],
17752
+ rightMarkerPx = _map2[1];
17753
+
17754
+ if (leftMarkerDragging) {
17755
+ var mousePosition = leftMarkerPx + x;
17756
+ var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2;
17757
+ if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // eslint-disable-next-line no-param-reassign
17758
+
17759
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
17760
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
17761
+ setLocalAnimationStartTime(mouseTimeUnix);
17762
+ setTooltipTime(moment.unix(mouseTimeUnix));
17763
+ return;
17764
+ }
17765
+
17766
+ if (rightMarkerDragging) {
17767
+ var _mousePosition = rightMarkerPx + x;
17768
+
17769
+ var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2;
17770
+ if (leftAnimationPosition >= _mousePosition || _mousePosition >= canvasWidth) return; // eslint-disable-next-line no-param-reassign
17771
+
17772
+ dragTooltipPosition.current = pixelsToLeft ? _mousePosition + pixelsToLeft : _mousePosition;
17773
+
17774
+ var _mouseTimeUnix = pixelToTimestamp(_mousePosition, centerTime, canvasWidth, secondsPerPx);
17775
+
17776
+ setLocalAnimationEndTime(_mouseTimeUnix);
17777
+ setTooltipTime(moment.unix(_mouseTimeUnix));
17778
+ return;
17779
+ }
17780
+
17781
+ if (animationAreaDragging) {
17782
+ if (animationDiff.current === undefined) {
17783
+ var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
17784
+ var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
17785
+ var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
17786
+ animationDiff.current = {
17787
+ diffStartToRight: diffRightAnimationToStartDraggingPosition,
17788
+ diffStartToLeft: diffLeftAnimationToStartDraggingPosition
17789
+ };
17790
+ return;
17791
+ }
17792
+
17793
+ pixelsMovedSinceStartDragging.current += x;
17794
+ var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
17795
+ var _animationDiff$curren = animationDiff.current,
17796
+ diffStartToRight = _animationDiff$curren.diffStartToRight,
17797
+ diffStartToLeft = _animationDiff$curren.diffStartToLeft;
17798
+ var startTime = currentPositionTimestamp - diffStartToLeft;
17799
+ var endTime = currentPositionTimestamp + diffStartToRight;
17800
+ setLocalAnimationStartTime(startTime);
17801
+ setLocalAnimationEndTime(endTime);
17802
+ }
17803
+ }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition]);
17804
+ return {
17805
+ handleAnimationDragging: handleAnimationDragging,
17806
+ localAnimationEndTime: localAnimationEndTime,
17807
+ localAnimationStartTime: localAnimationStartTime
17808
+ };
17809
+ }
17810
+
17811
+ function useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime) {
17812
+ var curTime = selectedTime !== undefined ? moment.unix(selectedTime).toISOString() : moment.utc().toISOString();
17813
+ React.useEffect(function () {
17814
+ var handleKeyDown = function handleKeyDown(event) {
17815
+ if (event.key === 'Home' && mapIsActive) {
17816
+ handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17817
+ }
17818
+
17819
+ if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
17820
+ switch (event.code) {
17821
+ case 'ArrowLeft':
17822
+ setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate);
17823
+ break;
17824
+
17825
+ case 'ArrowRight':
17826
+ setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate);
17827
+ break;
17828
+ }
17829
+ }
17830
+ };
17831
+
17832
+ document.addEventListener('keydown', handleKeyDown);
17833
+ return function () {
17834
+ document.removeEventListener('keydown', handleKeyDown);
17835
+ };
17836
+ }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
17837
+ }
17838
+
17839
+ function convertStringTimeToUnix(time) {
17840
+ return time ? moment.utc(time).unix() : undefined;
17841
+ } // Explanation of props can be found here:
17842
+ // https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
17536
17843
 
17537
- var DRAG_AREA_WIDTH = 24;
17538
17844
 
17539
17845
  var TimeSliderLegend = function TimeSliderLegend(_ref) {
17540
17846
  var mapId = _ref.mapId,
@@ -17555,202 +17861,97 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17555
17861
  mapIsActive = _ref$mapIsActive === void 0 ? true : _ref$mapIsActive,
17556
17862
  unfilteredSelectedTime = _ref.unfilteredSelectedTime,
17557
17863
  setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
17558
- onSetNewDate = _ref.onSetNewDate,
17559
- onSetCenterTime = _ref.onSetCenterTime,
17560
- onSetAnimationStartTime = _ref.onSetAnimationStartTime,
17561
- onSetAnimationEndTime = _ref.onSetAnimationEndTime;
17864
+ _ref$onSetNewDate = _ref.onSetNewDate,
17865
+ onSetNewDate = _ref$onSetNewDate === void 0 ? function () {} : _ref$onSetNewDate,
17866
+ _ref$onSetCenterTime = _ref.onSetCenterTime,
17867
+ onSetCenterTime = _ref$onSetCenterTime === void 0 ? function () {} : _ref$onSetCenterTime,
17868
+ _ref$onSetAnimationSt = _ref.onSetAnimationStartTime,
17869
+ onSetAnimationStartTime = _ref$onSetAnimationSt === void 0 ? function () {} : _ref$onSetAnimationSt,
17870
+ _ref$onSetAnimationEn = _ref.onSetAnimationEndTime,
17871
+ onSetAnimationEndTime = _ref$onSetAnimationEn === void 0 ? function () {} : _ref$onSetAnimationEn;
17872
+ useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime);
17562
17873
 
17563
17874
  var _useCanvasTarget = useCanvasTarget('mousedown'),
17564
17875
  _useCanvasTarget2 = _slicedToArray(_useCanvasTarget, 2),
17565
17876
  node = _useCanvasTarget2[1];
17566
17877
 
17567
- var _React$useState = React.useState(0),
17568
- _React$useState2 = _slicedToArray(_React$useState, 2),
17569
- canvasWidth = _React$useState2[0],
17570
- setCanvasWidth = _React$useState2[1];
17571
-
17572
- var _React$useState3 = React.useState(false),
17573
- _React$useState4 = _slicedToArray(_React$useState3, 2),
17574
- selectedTimeDragging = _React$useState4[0],
17575
- setSelectedTimeDragging = _React$useState4[1];
17576
-
17577
- var _React$useState5 = React.useState(false),
17878
+ var _React$useState5 = React.useState(0),
17578
17879
  _React$useState6 = _slicedToArray(_React$useState5, 2),
17579
- leftMarkerDragging = _React$useState6[0],
17580
- setLeftMarkerDragging = _React$useState6[1];
17880
+ canvasWidth = _React$useState6[0],
17881
+ setCanvasWidth = _React$useState6[1];
17581
17882
 
17582
17883
  var _React$useState7 = React.useState(false),
17583
17884
  _React$useState8 = _slicedToArray(_React$useState7, 2),
17584
- rightMarkerDragging = _React$useState8[0],
17585
- setRightMarkerDragging = _React$useState8[1];
17885
+ selectedTimeDragging = _React$useState8[0],
17886
+ setSelectedTimeDragging = _React$useState8[1];
17586
17887
 
17587
17888
  var _React$useState9 = React.useState(false),
17588
17889
  _React$useState10 = _slicedToArray(_React$useState9, 2),
17589
- centerTimeDragging = _React$useState10[0],
17590
- setCenterTimeDragging = _React$useState10[1];
17890
+ leftMarkerDragging = _React$useState10[0],
17891
+ setLeftMarkerDragging = _React$useState10[1];
17591
17892
 
17592
17893
  var _React$useState11 = React.useState(false),
17593
17894
  _React$useState12 = _slicedToArray(_React$useState11, 2),
17594
- dragTooltipOpen = _React$useState12[0],
17595
- setDragTooltipOpen = _React$useState12[1];
17895
+ rightMarkerDragging = _React$useState12[0],
17896
+ setRightMarkerDragging = _React$useState12[1];
17596
17897
 
17597
17898
  var _React$useState13 = React.useState(false),
17598
17899
  _React$useState14 = _slicedToArray(_React$useState13, 2),
17599
- mouseDownInLegend = _React$useState14[0],
17600
- setMouseDownInLegend = _React$useState14[1];
17900
+ dragTooltipOpen = _React$useState14[0],
17901
+ setDragTooltipOpen = _React$useState14[1];
17601
17902
 
17602
- var _React$useState15 = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
17903
+ var _React$useState15 = React.useState(false),
17603
17904
  _React$useState16 = _slicedToArray(_React$useState15, 2),
17604
- localAnimationStartTime = _React$useState16[0],
17605
- setLocalAnimationStartTime = _React$useState16[1];
17905
+ mouseDownInLegend = _React$useState16[0],
17906
+ setMouseDownInLegend = _React$useState16[1];
17606
17907
 
17607
- var _React$useState17 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
17908
+ var _React$useState17 = React.useState(false),
17608
17909
  _React$useState18 = _slicedToArray(_React$useState17, 2),
17609
- localAnimationEndTime = _React$useState18[0],
17610
- setLocalAnimationEndTime = _React$useState18[1];
17910
+ animationAreaDragging = _React$useState18[0],
17911
+ setAnimationAreaDragging = _React$useState18[1];
17611
17912
 
17612
- var _React$useState19 = React.useState(moment.utc(0)),
17913
+ var _React$useState19 = React.useState('auto'),
17613
17914
  _React$useState20 = _slicedToArray(_React$useState19, 2),
17614
- tooltipTime = _React$useState20[0],
17615
- setTooltipTime = _React$useState20[1];
17616
-
17617
- var _React$useState21 = React.useState(false),
17618
- _React$useState22 = _slicedToArray(_React$useState21, 2),
17619
- animationAreaDragging = _React$useState22[0],
17620
- setAnimationAreaDragging = _React$useState22[1];
17621
-
17622
- var animationDiff = React.useRef();
17623
- var isClickOrDrag = React.useRef();
17624
- var pixelsMovedSinceStartDragging = React.useRef(0);
17625
- var elem = document.querySelector(".timeSliderLegend_".concat(mapId));
17626
- var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left'];
17627
- var pixelsToTop = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['top'];
17628
-
17629
- var _React$useState23 = React.useState('auto'),
17630
- _React$useState24 = _slicedToArray(_React$useState23, 2),
17631
- cursorStyle = _React$useState24[0],
17632
- setCursorStyle = _React$useState24[1];
17633
-
17634
- var curTime = selectedTime !== undefined ? moment.unix(selectedTime).toISOString() : moment.utc().toISOString();
17635
- React.useEffect(function () {
17636
- setLocalAnimationStartTime(animationStartTime && moment.utc(animationStartTime).unix());
17637
- setLocalAnimationEndTime(animationEndTime && moment.utc(animationEndTime).unix());
17638
- }, [animationStartTime, animationEndTime]);
17639
- React.useEffect(function () {
17640
- var handleKeyDown = function handleKeyDown(event) {
17641
- if (event.key === 'Home' && mapIsActive) {
17642
- handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17643
- }
17644
-
17645
- if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
17646
- switch (event.code) {
17647
- case 'ArrowLeft':
17648
- setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate);
17649
- break;
17650
-
17651
- case 'ArrowRight':
17652
- setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate);
17653
- break;
17654
- }
17655
- }
17656
- };
17657
-
17658
- document.addEventListener('keydown', handleKeyDown);
17659
- return function () {
17660
- document.removeEventListener('keydown', handleKeyDown);
17661
- };
17662
- }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
17915
+ cursorStyle = _React$useState20[0],
17916
+ setCursorStyle = _React$useState20[1];
17663
17917
  /**
17664
17918
  * remove active drag. can happen outside canvas.
17665
17919
  */
17666
17920
 
17921
+
17667
17922
  React.useEffect(function () {
17668
17923
  var handleMouseUp = function handleMouseUp() {
17669
- centerTimeDragging ? setCursorStyle('auto') : setCursorStyle('ew-resize');
17924
+ setCursorStyle('auto');
17670
17925
  setSelectedTimeDragging(false);
17671
17926
  setLeftMarkerDragging(false);
17672
17927
  setRightMarkerDragging(false);
17673
17928
  setMouseDownInLegend(false);
17674
- setCenterTimeDragging(false);
17675
17929
  setDragTooltipOpen(false);
17676
17930
  setAnimationAreaDragging(false);
17677
17931
  startDraggingPosition.current = 0;
17678
- pixelsMovedSinceStartDragging.current = 0;
17679
- animationDiff.current = undefined;
17680
17932
  };
17681
17933
 
17682
17934
  document.addEventListener('mouseup', handleMouseUp);
17683
17935
  return function () {
17684
17936
  document.removeEventListener('mouseup', handleMouseUp);
17685
17937
  };
17686
- }, [centerTimeDragging]);
17687
- var onMouseTouchMoveActions = useCallback(function (x) {
17688
- if (!localAnimationStartTime || !localAnimationEndTime) return;
17689
-
17690
- var _map = [localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
17691
- return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
17692
- }),
17693
- _map2 = _slicedToArray(_map, 2),
17694
- leftMarkerPx = _map2[0],
17695
- rightMarkerPx = _map2[1];
17696
-
17697
- if (leftMarkerDragging) {
17698
- var mousePosition = leftMarkerPx + x;
17699
- var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2; // update tooltip position while dragging
17700
- // Prevent dragging if it would cause markers to cross over, except if the markers
17701
- // are moved away from being crossed over
17702
-
17703
- if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // set animation drag info dialog location
17704
-
17705
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
17706
-
17707
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
17708
- centerTime, canvasWidth, secondsPerPx);
17709
- setLocalAnimationStartTime(mouseTimeUnix);
17710
- setTooltipTime(moment.unix(mouseTimeUnix));
17711
- return;
17712
- }
17713
-
17714
- if (rightMarkerDragging) {
17715
- var _mousePosition = rightMarkerPx + x;
17716
-
17717
- var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2; // Similar condition for other marker
17718
-
17719
- if (leftAnimationPosition >= _mousePosition || _mousePosition >= canvasWidth) return; // set animation drag info dialog location
17720
-
17721
- dragTooltipPosition.current = pixelsToLeft ? _mousePosition + pixelsToLeft : _mousePosition; // change local time bounds according to either dragged marker
17722
-
17723
- var _mouseTimeUnix = pixelToTimestamp(_mousePosition, // lets us drag on the marker
17724
- centerTime, canvasWidth, secondsPerPx);
17938
+ }, []);
17939
+ var dragTooltipPosition = React.useRef();
17940
+ var startDraggingPosition = React.useRef(0);
17941
+ var timeSliderLegendId = "timeSliderLegend_".concat(mapId);
17942
+ var timeSliderLegendElement = document.querySelector(".".concat(timeSliderLegendId));
17943
+ var pixelsToLeft = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['left'];
17725
17944
 
17726
- setLocalAnimationEndTime(_mouseTimeUnix);
17727
- setTooltipTime(moment.unix(_mouseTimeUnix));
17728
- return;
17729
- }
17945
+ var _React$useState21 = React.useState(moment.utc(0)),
17946
+ _React$useState22 = _slicedToArray(_React$useState21, 2),
17947
+ tooltipTime = _React$useState22[0],
17948
+ setTooltipTime = _React$useState22[1];
17730
17949
 
17731
- if (animationAreaDragging) {
17732
- if (animationDiff.current === undefined) {
17733
- var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
17734
- var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
17735
- var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
17736
- animationDiff.current = {
17737
- diffStartToRight: diffRightAnimationToStartDraggingPosition,
17738
- diffStartToLeft: diffLeftAnimationToStartDraggingPosition
17739
- };
17740
- return;
17741
- }
17950
+ var _useAnimationTime = useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition),
17951
+ handleAnimationDragging = _useAnimationTime.handleAnimationDragging,
17952
+ localAnimationEndTime = _useAnimationTime.localAnimationEndTime,
17953
+ localAnimationStartTime = _useAnimationTime.localAnimationStartTime;
17742
17954
 
17743
- pixelsMovedSinceStartDragging.current += x;
17744
- var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
17745
- var _animationDiff$curren = animationDiff.current,
17746
- diffStartToRight = _animationDiff$curren.diffStartToRight,
17747
- diffStartToLeft = _animationDiff$curren.diffStartToLeft;
17748
- var startTime = currentPositionTimestamp - diffStartToLeft;
17749
- var endTime = currentPositionTimestamp + diffStartToRight;
17750
- setLocalAnimationStartTime(startTime);
17751
- setLocalAnimationEndTime(endTime);
17752
- }
17753
- }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, pixelsToLeft, animationDiff]);
17754
17955
  var setSelectedTime = useCallback(function (x) {
17755
17956
  var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
17756
17957
  setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
@@ -17761,12 +17962,11 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17761
17962
  if (event.movementX === 0) return;
17762
17963
 
17763
17964
  if (mouseDownInLegend) {
17764
- setCenterTimeDragging(true);
17765
17965
  var dragDistanceTime = event.movementX * secondsPerPx;
17766
17966
  var newCenterTime = centerTime - dragDistanceTime;
17767
17967
  onSetCenterTime && onSetCenterTime(newCenterTime);
17768
17968
  } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
17769
- onMouseTouchMoveActions(event.movementX);
17969
+ handleAnimationDragging(event.movementX);
17770
17970
  } else if (selectedTimeDragging) {
17771
17971
  setSelectedTime(event.movementX);
17772
17972
  }
@@ -17776,9 +17976,9 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17776
17976
  return function () {
17777
17977
  document.removeEventListener('mousemove', handleMouseMove);
17778
17978
  };
17779
- }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, onMouseTouchMoveActions, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
17979
+ }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, handleAnimationDragging, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
17780
17980
  var theme = useTheme();
17781
- var startDraggingPosition = React.useRef(0);
17981
+ var isClickOrDrag = React.useRef();
17782
17982
 
17783
17983
  var onMouseDown = function onMouseDown(x, y, width) {
17784
17984
  isClickOrDrag.current = 'click';
@@ -17799,7 +17999,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17799
17999
  return;
17800
18000
  }
17801
18001
 
17802
- if (animationStartTime && animationEndTime && onSetAnimationStartTime && onSetAnimationEndTime) {
18002
+ if (animationStartTime && animationEndTime) {
17803
18003
  dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
17804
18004
 
17805
18005
  if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
@@ -17829,22 +18029,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17829
18029
  setMouseDownInLegend(true);
17830
18030
  };
17831
18031
 
17832
- React.useEffect(function () {
17833
- var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
17834
-
17835
- if (stoppedDragging) {
17836
- if (localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
17837
- onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17838
- }
17839
-
17840
- if (localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
17841
- onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17842
- }
17843
- } // eslint-disable-next-line react-hooks/exhaustive-deps
17844
-
17845
- }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
17846
-
17847
- var onMouseUpTouchEnd = function onMouseUpTouchEnd(x) {
18032
+ var onMouseUp = function onMouseUp(x) {
17848
18033
  if (isClickOrDrag.current === 'click') {
17849
18034
  // we need to set the unfiltered time, so the timebox will update accordingly
17850
18035
  setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
@@ -17887,8 +18072,8 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17887
18072
  }
17888
18073
  };
17889
18074
 
17890
- var dragTooltipPosition = React.useRef();
17891
18075
  var popperRef = React.useRef(null);
18076
+ var pixelsToTop = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['top'];
17892
18077
 
17893
18078
  var setTooltipPosition = function setTooltipPosition() {
17894
18079
  var tooltipX = dragTooltipPosition.current;
@@ -17907,7 +18092,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17907
18092
  }
17908
18093
  }, /*#__PURE__*/React.createElement(Box, {
17909
18094
  "data-testid": "timeSliderLegend",
17910
- className: "timeSliderLegend_".concat(mapId),
18095
+ className: timeSliderLegendId,
17911
18096
  sx: {
17912
18097
  height: "".concat(TIME_SLIDER_LEGEND_HEIGHT, "px"),
17913
18098
  borderRadius: '4.5px',
@@ -17924,7 +18109,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17924
18109
  onSetCenterTime && onSetCenterTime(newCenterTime);
17925
18110
  },
17926
18111
  onMouseDown: onMouseDown,
17927
- onMouseUp: onMouseUpTouchEnd,
18112
+ onMouseUp: onMouseUp,
17928
18113
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
17929
18114
  setCanvasWidth(width);
17930
18115
  drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
@@ -17932,12 +18117,6 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17932
18117
  })));
17933
18118
  };
17934
18119
 
17935
- function convertStringTimeToUnix(time) {
17936
- return time ? moment.utc(time).unix() : undefined;
17937
- }
17938
-
17939
- var TIME_SLIDER_LEGEND_HEIGHT = 24;
17940
-
17941
18120
  /* *
17942
18121
  * Licensed under the Apache License, Version 2.0 (the "License");
17943
18122
  * you may not use this file except in compliance with the License.
@@ -18381,26 +18560,46 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18381
18560
  var isTimestepAuto$1 = useSelector(function (store) {
18382
18561
  return isTimestepAuto(store, mapId);
18383
18562
  });
18384
- var onToggleTimestepAuto = React.useCallback(function () {
18563
+ var activeLayerId = useSelector(function (store) {
18564
+ return getActiveLayerId(store, mapId);
18565
+ });
18566
+ var activeLayerTimeDimension = useSelector(function (store) {
18567
+ return getLayerTimeDimension(store, activeLayerId);
18568
+ });
18569
+
18570
+ var onToggleTimestepAuto = function onToggleTimestepAuto() {
18571
+ var newTimestepAuto = !isTimestepAuto$1;
18572
+
18573
+ if (newTimestepAuto) {
18574
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
18575
+
18576
+ if (timeStepFromLayer) {
18577
+ dispatch(mapActions$1.setTimeStep({
18578
+ mapId: mapId,
18579
+ timeStep: timeStepFromLayer
18580
+ }));
18581
+ }
18582
+ }
18583
+
18385
18584
  dispatch(mapActions$1.toggleTimestepAuto({
18386
18585
  mapId: mapId,
18387
- timestepAuto: !isTimestepAuto$1,
18388
- origin: MapActionOrigin.map
18586
+ timestepAuto: newTimestepAuto
18389
18587
  }));
18390
- }, [dispatch, isTimestepAuto$1, mapId]);
18391
- var onSetTimeStep = React.useCallback(function (timeStep, origin) {
18392
- dispatch(mapActions$1.setTimeStep(Object.assign({
18588
+ };
18589
+
18590
+ var onSetTimeStep = function onSetTimeStep(timeStep) {
18591
+ dispatch(mapActions$1.setTimeStep({
18393
18592
  mapId: mapId,
18394
18593
  timeStep: timeStep
18395
- }, origin && {
18396
- origin: origin
18397
- })));
18398
- }, [dispatch, mapId]);
18594
+ }));
18595
+ };
18596
+
18399
18597
  return /*#__PURE__*/React.createElement(TimeStepButton, {
18400
18598
  timeStep: timeStep,
18401
18599
  onChangeTimeStep: onSetTimeStep,
18402
18600
  disabled: isAnimating$1,
18403
- onToggleTimestepAuto: onToggleTimestepAuto
18601
+ onToggleTimestepAuto: onToggleTimestepAuto,
18602
+ isTimestepAuto: Boolean(isTimestepAuto$1)
18404
18603
  });
18405
18604
  };
18406
18605
 
@@ -18567,7 +18766,8 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18567
18766
  return /*#__PURE__*/React.createElement(AnimationLengthButton, {
18568
18767
  disabled: isAnimating$1,
18569
18768
  animationLength: currentLength || Number(AnimationLength.Hours24),
18570
- onChangeAnimationLength: handlechangeAnimationLength
18769
+ onChangeAnimationLength: handlechangeAnimationLength,
18770
+ animationLengthInMinutes: currentDiffInMinutes
18571
18771
  });
18572
18772
  };
18573
18773
 
@@ -18599,27 +18799,6 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18599
18799
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18600
18800
  var sourceId = _ref.sourceId,
18601
18801
  mapId = _ref.mapId;
18602
- var dispatch = useDispatch();
18603
- var isTimestepAuto$1 = useSelector(function (store) {
18604
- return isTimestepAuto(store, mapId);
18605
- });
18606
- var timeStep = useSelector(function (store) {
18607
- return getMapTimeStep(store, mapId);
18608
- });
18609
- var activeLayerId = useSelector(function (store) {
18610
- return getActiveLayerId(store, mapId);
18611
- });
18612
- var activeLayerTimeDimension = useSelector(function (store) {
18613
- return getLayerTimeDimension(store, activeLayerId);
18614
- });
18615
- var onSetTimeStep = React.useCallback(function (timeStep, origin) {
18616
- dispatch(mapActions$1.setTimeStep(Object.assign({
18617
- mapId: mapId,
18618
- timeStep: timeStep
18619
- }, origin && {
18620
- origin: origin
18621
- })));
18622
- }, [dispatch, mapId]);
18623
18802
  return /*#__PURE__*/React.createElement(OptionsMenuButton, {
18624
18803
  nowBtn: /*#__PURE__*/React.createElement(NowButtonConnect, {
18625
18804
  mapId: mapId,
@@ -18639,11 +18818,7 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18639
18818
  }),
18640
18819
  timeScaleBtn: /*#__PURE__*/React.createElement(TimeScaleButtonConnect, {
18641
18820
  mapId: mapId
18642
- }),
18643
- timeStep: timeStep,
18644
- isTimestepAuto: isTimestepAuto$1,
18645
- onChangeTimeStep: onSetTimeStep,
18646
- timeDimension: activeLayerTimeDimension
18821
+ })
18647
18822
  });
18648
18823
  };
18649
18824
 
@@ -19758,6 +19933,34 @@ var checkHoverFeatures = function checkHoverFeatures(geojson, mouseX, mouseY, co
19758
19933
 
19759
19934
  return null;
19760
19935
  };
19936
+ var generatedDrawFunctionIds = 0;
19937
+
19938
+ var generateDrawFunctionId = function generateDrawFunctionId() {
19939
+ generatedDrawFunctionIds += 1;
19940
+ return "drawFunctionId_".concat(generatedDrawFunctionIds);
19941
+ };
19942
+ /**
19943
+ * DrawFunction store for re-use of drawFunctions
19944
+ */
19945
+
19946
+
19947
+ var drawFunctionStore = [];
19948
+ var getDrawFunctionFromStore = function getDrawFunctionFromStore(id) {
19949
+ var drawFunction = drawFunctionStore.find(function (drawFunction) {
19950
+ return drawFunction.id === id;
19951
+ });
19952
+ return drawFunction === null || drawFunction === void 0 ? void 0 : drawFunction.drawMethod;
19953
+ };
19954
+ var registerDrawFunction = function registerDrawFunction() {
19955
+ var drawFunction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
19956
+ var id = generateDrawFunctionId();
19957
+ var newFunction = {
19958
+ id: id,
19959
+ drawMethod: drawFunction
19960
+ };
19961
+ drawFunctionStore.push(newFunction);
19962
+ return id;
19963
+ };
19761
19964
 
19762
19965
  var Proj4js = proj4; // Cache for for storing and reusing Proj4 instances
19763
19966
 
@@ -21561,22 +21764,25 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
21561
21764
  }
21562
21765
 
21563
21766
  var drawStyledMarker = featureProperties ? featureProperties.stroke || featureProperties['stroke-width'] || featureProperties.fill : null;
21564
- var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunction;
21565
-
21566
- if (featureProperties.drawFunction) {
21567
- var isHovered = this.featureEvent && this.featureEvent.feature === feature;
21568
- featureProperties.drawFunction({
21569
- context: ctx,
21570
- featureIndex: featureIndex,
21571
- coord: _coord,
21572
- selected: selected,
21573
- middle: middle,
21574
- isInEditMode: isInEditMode,
21575
- feature: feature,
21576
- mouseX: this.mouseX,
21577
- mouseY: this.mouseY,
21578
- isHovered: isHovered
21579
- });
21767
+ var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunctionId;
21768
+
21769
+ if (featureProperties.drawFunctionId) {
21770
+ var drawFunction = getDrawFunctionFromStore(featureProperties.drawFunctionId);
21771
+
21772
+ if (drawFunction) {
21773
+ var isHovered = this.featureEvent && this.featureEvent.feature === feature;
21774
+ drawFunction({
21775
+ context: ctx,
21776
+ featureIndex: featureIndex,
21777
+ coord: _coord,
21778
+ selected: selected,
21779
+ isInEditMode: isInEditMode,
21780
+ feature: feature,
21781
+ mouseX: this.mouseX,
21782
+ mouseY: this.mouseY,
21783
+ isHovered: isHovered
21784
+ });
21785
+ }
21580
21786
  } else if (drawStyledMarker || drawMarkerByDefault) {
21581
21787
  this.drawMarker(ctx, _coord, selected, middle, isInEditMode, featureProperties);
21582
21788
  }
@@ -22171,9 +22377,8 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22171
22377
  key: "componentDidMount",
22172
22378
  value: function componentDidMount() {
22173
22379
  var _this$props2 = this.props,
22174
- onMount = _this$props2.onMount,
22380
+ onWMJSMount = _this$props2.onWMJSMount,
22175
22381
  mapId = _this$props2.mapId,
22176
- onRegisterAdaguc = _this$props2.onRegisterAdaguc,
22177
22382
  shouldAutoFetch = _this$props2.shouldAutoFetch;
22178
22383
  this.checkAdaguc();
22179
22384
  this.checkNewProps(null, this.props);
@@ -22181,13 +22386,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22181
22386
 
22182
22387
  if (this.adaguc.initialized === false && this.adaguc.webMapJS) {
22183
22388
  this.adaguc.initialized = true;
22184
-
22185
- if (onRegisterAdaguc) {
22186
- onRegisterAdaguc(this.adaguc.webMapJS);
22187
- }
22188
22389
  }
22189
22390
 
22190
- onMount(mapId, this.adaguc.webMapJS);
22391
+ onWMJSMount(mapId);
22191
22392
 
22192
22393
  if (shouldAutoFetch) {
22193
22394
  this.onStartRefetchTimer();
@@ -22196,11 +22397,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22196
22397
  }, {
22197
22398
  key: "componentWillUnmount",
22198
22399
  value: function componentWillUnmount() {
22199
- var _this$props3 = this.props,
22200
- onUnMount = _this$props3.onUnMount,
22201
- mapId = _this$props3.mapId;
22202
22400
  window.removeEventListener('resize', this.handleWindowResize);
22203
- onUnMount(mapId, this.adaguc.webMapJS);
22204
22401
  this.adaguc.webMapJS.getListener().suspendEvents();
22205
22402
 
22206
22403
  if (typeof this.adaguc.webMapJS.stopAnimating === 'function') {
@@ -22214,9 +22411,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22214
22411
  }, {
22215
22412
  key: "onDimChangeListener",
22216
22413
  value: function onDimChangeListener() {
22217
- var _this$props4 = this.props,
22218
- mapId = _this$props4.mapId,
22219
- onMapChangeDimension = _this$props4.onMapChangeDimension;
22414
+ var _this$props3 = this.props,
22415
+ mapId = _this$props3.mapId,
22416
+ onMapChangeDimension = _this$props3.onMapChangeDimension;
22220
22417
 
22221
22418
  if (this.adaguc && this.adaguc.webMapJS) {
22222
22419
  var timeDimension = this.adaguc.webMapJS.getDimension('time');
@@ -22238,9 +22435,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22238
22435
  value: function onAfterSetBBoxListener(wmjsMap) {
22239
22436
  var _this2 = this;
22240
22437
 
22241
- var _this$props5 = this.props,
22242
- mapId = _this$props5.mapId,
22243
- onMapZoomEnd = _this$props5.onMapZoomEnd;
22438
+ var _this$props4 = this.props,
22439
+ mapId = _this$props4.mapId,
22440
+ onMapZoomEnd = _this$props4.onMapZoomEnd;
22244
22441
  /* Update the map after 100 ms */
22245
22442
 
22246
22443
  window.setTimeout(function () {
@@ -22695,12 +22892,12 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22695
22892
  value: function checkAdaguc() {
22696
22893
  var _this4 = this;
22697
22894
 
22698
- var _this$props6 = this.props,
22699
- mapId = _this$props6.mapId,
22700
- listeners = _this$props6.listeners,
22701
- srs = _this$props6.srs,
22702
- bbox = _this$props6.bbox,
22703
- onMapPinChangeLocation = _this$props6.onMapPinChangeLocation;
22895
+ var _this$props5 = this.props,
22896
+ mapId = _this$props5.mapId,
22897
+ listeners = _this$props5.listeners,
22898
+ srs = _this$props5.srs,
22899
+ bbox = _this$props5.bbox,
22900
+ onMapPinChangeLocation = _this$props5.onMapPinChangeLocation;
22704
22901
 
22705
22902
  if (this.adaguc.webMapJSCreated) {
22706
22903
  return;
@@ -22774,10 +22971,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22774
22971
  }, {
22775
22972
  key: "render",
22776
22973
  value: function render() {
22777
- var _this$props7 = this.props,
22778
- passiveMap = _this$props7.passiveMap,
22779
- children = _this$props7.children,
22780
- onClick = _this$props7.onClick;
22974
+ var _this$props6 = this.props,
22975
+ passiveMap = _this$props6.passiveMap,
22976
+ children = _this$props6.children,
22977
+ onClick = _this$props6.onClick;
22781
22978
  var adagucInitialised = this.state.adagucInitialised;
22782
22979
  var featureLayers = getFeatureLayers(children);
22783
22980
  return /*#__PURE__*/React.createElement("div", {
@@ -22858,8 +23055,7 @@ ReactMapView.defaultProps = {
22858
23055
  shouldAutoFetch: true,
22859
23056
  displayMapPin: false,
22860
23057
  disableMapPin: false,
22861
- onMount: function onMount() {},
22862
- onUnMount: function onUnMount() {},
23058
+ onWMJSMount: function onWMJSMount() {},
22863
23059
  onMapChangeDimension: function onMapChangeDimension() {
22864
23060
  /* nothing */
22865
23061
  },
@@ -22951,8 +23147,8 @@ var MapView = function MapView(_a) {
22951
23147
  displayTimeInMap = _a$displayTimeInMap === void 0 ? true : _a$displayTimeInMap,
22952
23148
  props = __rest(_a, ["children", "controls", "displayTimeInMap"]);
22953
23149
 
22954
- var dimensions = props.dimensions;
22955
- var adagucRef = React.useRef(null);
23150
+ var dimensions = props.dimensions,
23151
+ mapId = props.mapId;
22956
23152
  return /*#__PURE__*/React.createElement(Box, {
22957
23153
  sx: {
22958
23154
  display: 'grid',
@@ -22968,13 +23164,16 @@ var MapView = function MapView(_a) {
22968
23164
  }
22969
23165
  }, /*#__PURE__*/React.createElement(ZoomControls, {
22970
23166
  onZoomIn: function onZoomIn() {
22971
- return adagucRef.current.zoomIn(undefined);
23167
+ var wmjsMap = getWMJSMapById(mapId);
23168
+ wmjsMap.zoomIn(undefined);
22972
23169
  },
22973
23170
  onZoomOut: function onZoomOut() {
22974
- return adagucRef.current.zoomOut();
23171
+ var wmjsMap = getWMJSMapById(mapId);
23172
+ wmjsMap.zoomOut();
22975
23173
  },
22976
23174
  onZoomReset: function onZoomReset() {
22977
- return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
23175
+ var wmjsMap = getWMJSMapById(mapId);
23176
+ wmjsMap.zoomToLayer(wmjsMap.getActiveLayer());
22978
23177
  }
22979
23178
  })), /*#__PURE__*/React.createElement(Box, {
22980
23179
  sx: {
@@ -22982,9 +23181,6 @@ var MapView = function MapView(_a) {
22982
23181
  gridRowStart: 1
22983
23182
  }
22984
23183
  }, /*#__PURE__*/React.createElement(ReactMapView, Object.assign({}, props, {
22985
- onRegisterAdaguc: function onRegisterAdaguc(adaguc) {
22986
- adagucRef.current = adaguc;
22987
- },
22988
23184
  showLegend: false,
22989
23185
  displayTimeInMap: false
22990
23186
  }), children)), displayTimeInMap && dimensions && /*#__PURE__*/React.createElement(MapTime, {
@@ -23353,7 +23549,7 @@ var MapViewConnect = function MapViewConnect(_a) {
23353
23549
  dispatch(mapActions$1.setMapPinLocation(payload));
23354
23550
  }, [dispatch]);
23355
23551
  var setSelectedFeature = React.useCallback(function (payload) {
23356
- dispatch(mapActions$1.setSelectedFeature(payload));
23552
+ dispatch(layerActions.setSelectedFeature(payload));
23357
23553
  }, [dispatch]);
23358
23554
  var activeWindowId = useSelector(getActiveWindowId);
23359
23555
 
@@ -23363,29 +23559,29 @@ var MapViewConnect = function MapViewConnect(_a) {
23363
23559
 
23364
23560
  useKeyboardZoomAndPan(isActiveWindowId(), mapId);
23365
23561
  useTouchZoomPan(isActiveWindowId(), mapId);
23366
- return /*#__PURE__*/React.createElement("div", {
23367
- style: {
23368
- height: '100%'
23369
- }
23370
- }, /*#__PURE__*/React.createElement(MapView, Object.assign({}, props, {
23371
- mapId: mapId,
23372
- onMount: function onMount() {
23373
- registerMap({
23374
- mapId: mapId
23375
- });
23376
- syncGroupAddSource({
23377
- id: mapId,
23378
- type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
23379
- });
23380
- },
23381
- onUnMount: function onUnMount() {
23562
+ React.useEffect(function () {
23563
+ registerMap({
23564
+ mapId: mapId
23565
+ });
23566
+ syncGroupAddSource({
23567
+ id: mapId,
23568
+ type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
23569
+ });
23570
+ return function () {
23382
23571
  unregisterMap({
23383
23572
  mapId: mapId
23384
23573
  });
23385
23574
  syncGroupRemoveSource({
23386
23575
  id: mapId
23387
23576
  });
23388
- },
23577
+ };
23578
+ }, [mapId, registerMap, syncGroupAddSource, syncGroupRemoveSource, unregisterMap]);
23579
+ return /*#__PURE__*/React.createElement("div", {
23580
+ style: {
23581
+ height: '100%'
23582
+ }
23583
+ }, /*#__PURE__*/React.createElement(MapView, Object.assign({}, props, {
23584
+ mapId: mapId,
23389
23585
  srs: srs,
23390
23586
  bbox: bbox,
23391
23587
  mapPinLocation: displayMapPin ? mapPinLocation : undefined,
@@ -23440,7 +23636,7 @@ var MapViewConnect = function MapViewConnect(_a) {
23440
23636
  },
23441
23637
  onClickFeature: layer.geojson ? function (event) {
23442
23638
  setSelectedFeature({
23443
- mapId: mapId,
23639
+ layerId: layer.id,
23444
23640
  selectedFeatureIndex: event === null || event === void 0 ? void 0 : event.featureIndex
23445
23641
  });
23446
23642
  } : undefined
@@ -24108,7 +24304,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
24108
24304
  /* Build a layerlist array with a set of arguments per layer to do the query for */
24109
24305
 
24110
24306
 
24111
- var layerToUpdateList = getLayersToUpdate(layers, mapId);
24307
+ var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
24112
24308
  /*
24113
24309
  Build a string based on the GFI urls. If this changes for whatever reason we need to update.
24114
24310
  These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
@@ -24150,7 +24346,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
24150
24346
  case 9:
24151
24347
  _context.prev = 9;
24152
24348
  _context.t0 = _context["catch"](0);
24153
- errorMessage = _context.t0.message();
24349
+ errorMessage = _context.t0.message;
24154
24350
  updateLayerResult({
24155
24351
  layerId: layerId,
24156
24352
  data: errorMessage,
@@ -24295,9 +24491,6 @@ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_ref) {
24295
24491
  mapId = _ref.mapId;
24296
24492
  var dispatch = useDispatch();
24297
24493
  var getFeatureInfoType = "getfeatureinfo-".concat(mapId);
24298
- var isMapPinVisible = useSelector(function (store) {
24299
- return getDisplayMapPin(store, mapId);
24300
- });
24301
24494
  var mapPinLocation = useSelector(function (store) {
24302
24495
  return getPinLocation(store, mapId);
24303
24496
  });
@@ -24307,6 +24500,14 @@ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_ref) {
24307
24500
  displayMapPin: displayMapPin
24308
24501
  }));
24309
24502
  }, [dispatch, mapId]);
24503
+
24504
+ var enableMapPin = function enableMapPin() {
24505
+ dispatch(mapActions$1.setDisableMapPin({
24506
+ mapId: mapId,
24507
+ disableMapPin: false
24508
+ }));
24509
+ };
24510
+
24310
24511
  var mapLayers = useSelector(function (store) {
24311
24512
  return getMapLayers(store, mapId);
24312
24513
  });
@@ -24320,7 +24521,14 @@ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_ref) {
24320
24521
 
24321
24522
  React.useEffect(function () {
24322
24523
  toggleMapPinIsVisible(isDialogOpen);
24323
- }, [isDialogOpen, toggleMapPinIsVisible, isMapPinVisible]);
24524
+
24525
+ if (isDialogOpen) {
24526
+ enableMapPin();
24527
+ }
24528
+ /* Do not respond on changes of isMapPinVisible, to allow other components to open/close the mappin. */
24529
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24530
+
24531
+ }, [isDialogOpen, toggleMapPinIsVisible]);
24324
24532
  return /*#__PURE__*/React.createElement(GetFeatureInfoDialog, {
24325
24533
  layers: mapLayers,
24326
24534
  isOpen: isDialogOpen,
@@ -25613,4 +25821,4 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
25613
25821
  * */
25614
25822
  var mapActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions$1), serviceActions);
25615
25823
 
25616
- export { ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$6 as layerReducer, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, useSetupDialog };
25824
+ export { ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$6 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, TimeSliderUtils as timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, useSetupDialog };