@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.umd.js CHANGED
@@ -212,6 +212,13 @@
212
212
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
213
213
  })(LayerActionOrigin || (LayerActionOrigin = {}));
214
214
 
215
+ var types$3 = /*#__PURE__*/Object.freeze({
216
+ __proto__: null,
217
+ get LayerType () { return LayerType; },
218
+ get LayerStatus () { return LayerStatus; },
219
+ get LayerActionOrigin () { return LayerActionOrigin; }
220
+ });
221
+
215
222
  /* *
216
223
  * Licensed under the Apache License, Version 2.0 (the "License");
217
224
  * you may not use this file except in compliance with the License.
@@ -582,6 +589,14 @@
582
589
  */
583
590
  [2147483647, 0]);
584
591
  };
592
+ var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
593
+ var newValue = value + 1;
594
+ return newValue > max ? max : newValue;
595
+ };
596
+ var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
597
+ var newValue = value - 1;
598
+ return newValue < min ? min : newValue;
599
+ };
585
600
  var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
586
601
  var prevTimeStep = moment__default["default"].utc(curTime).subtract(timeStep, 'm').toISOString();
587
602
 
@@ -608,43 +623,41 @@
608
623
 
609
624
  onsetNewDateDebounced(nextTimeStep, onSetNewDate);
610
625
  };
611
- var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
612
- switch (timeInterval.isRegularInterval) {
613
- case false:
614
- switch (timeInterval.year) {
615
- case 0:
616
- // month
617
- return 30 * 24 * 60;
618
-
619
- default:
620
- return timeInterval.year * 365 * 24 * 60;
621
- }
622
-
623
- case true:
624
- if (timeInterval.day !== 0) {
625
- return timeInterval.day * 24 * 60;
626
- }
626
+ var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max, supportFourDirectionNavigation) {
627
+ if (supportFourDirectionNavigation === void 0) {
628
+ supportFourDirectionNavigation = false;
629
+ }
627
630
 
628
- if (timeInterval.hour !== 0) {
629
- return timeInterval.hour * 60;
630
- }
631
+ if (!supportFourDirectionNavigation) {
632
+ if (event.ctrlKey || event.metaKey) {
633
+ switch (event.key) {
634
+ case 'ArrowDown':
635
+ return getPreviousTimeStepvalue(value, min);
631
636
 
632
- if (timeInterval.minute !== 0) {
633
- return timeInterval.minute;
634
- }
637
+ case 'ArrowUp':
638
+ return getNextTimeStepvalue(value, max);
635
639
 
636
- if (timeInterval.second !== 0) {
637
- return timeInterval.second / 60.0;
640
+ default:
641
+ return null;
638
642
  }
643
+ }
644
+ } else {
645
+ // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
646
+ switch (event.key) {
647
+ case 'ArrowDown':
648
+ case 'ArrowLeft':
649
+ return getPreviousTimeStepvalue(value, min);
639
650
 
640
- return 5;
651
+ case 'ArrowUp':
652
+ case 'ArrowRight':
653
+ return getNextTimeStepvalue(value, max);
641
654
 
642
- default:
643
- return 5;
655
+ default:
656
+ return null;
657
+ }
644
658
  }
645
- };
646
- var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
647
- return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
659
+
660
+ return null;
648
661
  };
649
662
  /**
650
663
  * This function calculates a suitable secondsPerpx value,
@@ -692,11 +705,39 @@
692
705
 
693
706
  return __assign(__assign({}, acc), (_b = {}, _b[v] = Number(k), _b));
694
707
  }, {});
708
+ /**
709
+ * This function creates and returns an array where there is secondsPerPx
710
+ * number of the data set added for a data scale (dataScaleToSecondsPerPx)
711
+ * to secondsPerPxToScale.
712
+ * @param dataScaleToSecondsPerPx
713
+ * @returns an array containing secondsPerPx numbers.
714
+ * The secondsPerPx number for a data scale is included
715
+ * contrary to secondsPerPxToScale.
716
+ */
717
+
718
+ var secondsPerPxValues = function secondsPerPxValues(dataScaleToSecondsPerPx) {
719
+ var sortedSecondsPerPx = __spreadArray([], __read(secondsPerPxToScale)).map(function (value) {
720
+ return Number(value[0]);
721
+ });
722
+
723
+ var full = __spreadArray(__spreadArray([], __read(sortedSecondsPerPx)), [dataScaleToSecondsPerPx]);
724
+
725
+ return full;
726
+ };
695
727
  var defaultDataScaleToSecondsPerPx = 43200;
696
728
  var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTimePoint, oldSecondsPerPx, newSecondsPerPx, oldCenterTime) {
697
729
  var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
698
730
  return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
699
731
  };
732
+ /**
733
+ * Move the time slider such that a given time point (timePoint)
734
+ * is at a given pixel width (timePointPx).
735
+ * @returns a new center time for the resulting position
736
+ */
737
+
738
+ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
739
+ return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
740
+ };
700
741
  /** This reusable custom hook tells whether given pointer event targets current canvas node.
701
742
  * Example:
702
743
  *
@@ -733,6 +774,10 @@
733
774
  cornerRadius: 5,
734
775
  lineWidth: 1
735
776
  };
777
+ var AUTO_MOVE_AREA_PADDING = 1;
778
+ var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
779
+ return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
780
+ };
736
781
  /** Reusable business logic for how to handle events that set time to now (closest).
737
782
  * Used in NowButton and TimeSliderLegend.
738
783
  */
@@ -752,6 +797,92 @@
752
797
  }
753
798
  }
754
799
  };
800
+ var TimeInMinutes;
801
+
802
+ (function (TimeInMinutes) {
803
+ TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
804
+ TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
805
+ TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
806
+ TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
807
+ })(TimeInMinutes || (TimeInMinutes = {}));
808
+
809
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
810
+ var dateStr = '';
811
+ var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
812
+
813
+ if (time >= TimeInMinutes.YEAR) {
814
+ var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
815
+ dateStr += yearsInMintues + "y";
816
+ time -= yearsInMintues * TimeInMinutes.YEAR;
817
+ }
818
+
819
+ if (time >= TimeInMinutes.MONTH) {
820
+ var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
821
+ dateStr += monthsInMinutes + "m";
822
+ time -= monthsInMinutes * TimeInMinutes.MONTH;
823
+ }
824
+
825
+ if (time >= TimeInMinutes.DAY) {
826
+ var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
827
+ dateStr += daysInMinutes + "d";
828
+ time -= daysInMinutes * TimeInMinutes.DAY;
829
+ } // we will always print hour/minutes if there are any of them in the XX:XX format
830
+
831
+
832
+ if (time > 0) {
833
+ if (dateStr !== '') dateStr += ' ';
834
+ dateStr += Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
835
+ minimumIntegerDigits: 2,
836
+ useGrouping: false
837
+ }) + "h" + (time % TimeInMinutes.HOUR).toLocaleString(undefined, {
838
+ minimumIntegerDigits: 2,
839
+ useGrouping: false
840
+ }) + "min";
841
+ }
842
+
843
+ return dateStr;
844
+ };
845
+
846
+ var TimeSliderUtils = /*#__PURE__*/Object.freeze({
847
+ __proto__: null,
848
+ millisecondsInSecond: millisecondsInSecond,
849
+ defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
850
+ defaultDelay: defaultDelay,
851
+ defaultTimeStep: defaultTimeStep,
852
+ speedFactors: speedFactors,
853
+ getSpeedDelay: getSpeedDelay,
854
+ getSpeedFactor: getSpeedFactor,
855
+ getSelectedTime: getSelectedTime,
856
+ getTimeBounds: getTimeBounds,
857
+ getMomentTimeBounds: getMomentTimeBounds,
858
+ scalingCoefficient: scalingCoefficient,
859
+ timestampToPixelEdges: timestampToPixelEdges,
860
+ timestampToPixel: timestampToPixel,
861
+ pixelToTimestamp: pixelToTimestamp,
862
+ onsetNewDateDebounced: onsetNewDateDebounced,
863
+ roundWithTimeStep: roundWithTimeStep,
864
+ setNewRoundedTime: setNewRoundedTime,
865
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
866
+ getNextTimeStepvalue: getNextTimeStepvalue,
867
+ getPreviousTimeStepvalue: getPreviousTimeStepvalue,
868
+ setPreviousTimeStep: setPreviousTimeStep,
869
+ setNextTimeStep: setNextTimeStep,
870
+ getValueFromKeyboardEvent: getValueFromKeyboardEvent,
871
+ getScaleToSecondsPerPxForDataScale: getScaleToSecondsPerPxForDataScale,
872
+ secondsPerPxToScale: secondsPerPxToScale,
873
+ scaleToSecondsPerPx: scaleToSecondsPerPx,
874
+ secondsPerPxValues: secondsPerPxValues,
875
+ defaultDataScaleToSecondsPerPx: defaultDataScaleToSecondsPerPx,
876
+ getNewCenterOfFixedPointZoom: getNewCenterOfFixedPointZoom,
877
+ moveRelativeToTimePoint: moveRelativeToTimePoint,
878
+ useCanvasTarget: useCanvasTarget,
879
+ needleGeom: needleGeom,
880
+ AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
881
+ getAutoMoveAreaWidth: getAutoMoveAreaWidth,
882
+ handleSetNowEvent: handleSetNowEvent,
883
+ get TimeInMinutes () { return TimeInMinutes; },
884
+ minutesToDescribedDuration: minutesToDescribedDuration
885
+ });
755
886
 
756
887
  var createMap = function createMap(_a) {
757
888
  var id = _a.id,
@@ -802,18 +933,12 @@
802
933
  isTimeSliderHoverOn = _w === void 0 ? false : _w,
803
934
  _x = _a.isTimeSliderVisible,
804
935
  isTimeSliderVisible = _x === void 0 ? true : _x,
805
- _y = _a.activeMapPresetId,
806
- activeMapPresetId = _y === void 0 ? null : _y,
807
- _z = _a.displayMapPin,
808
- displayMapPin = _z === void 0 ? false : _z,
809
- _0 = _a.disableMapPin,
810
- disableMapPin = _0 === void 0 ? false : _0,
811
- _1 = _a.shouldShowZoomControls,
812
- shouldShowZoomControls = _1 === void 0 ? true : _1,
813
- _2 = _a.dockedLayerManager,
814
- dockedLayerManager = _2 === void 0 ? {
815
- isOpen: false
816
- } : _2;
936
+ _y = _a.displayMapPin,
937
+ displayMapPin = _y === void 0 ? false : _y,
938
+ _z = _a.disableMapPin,
939
+ disableMapPin = _z === void 0 ? false : _z,
940
+ _0 = _a.shouldShowZoomControls,
941
+ shouldShowZoomControls = _0 === void 0 ? true : _0;
817
942
  return {
818
943
  id: id,
819
944
  isAnimating: isAnimating,
@@ -837,11 +962,9 @@
837
962
  isTimestepAuto: isTimestepAuto,
838
963
  isTimeSliderHoverOn: isTimeSliderHoverOn,
839
964
  isTimeSliderVisible: isTimeSliderVisible,
840
- activeMapPresetId: activeMapPresetId,
841
965
  displayMapPin: displayMapPin,
842
966
  disableMapPin: disableMapPin,
843
- shouldShowZoomControls: shouldShowZoomControls,
844
- dockedLayerManager: dockedLayerManager
967
+ shouldShowZoomControls: shouldShowZoomControls
845
968
  };
846
969
  };
847
970
  var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
@@ -981,6 +1104,44 @@
981
1104
  newArray.splice(indexNew, 0, newArray.splice(oldIndex, 1)[0]);
982
1105
  return newArray;
983
1106
  }
1107
+ var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
1108
+ switch (timeInterval.isRegularInterval) {
1109
+ case false:
1110
+ switch (timeInterval.year) {
1111
+ case 0:
1112
+ // month
1113
+ return 30 * 24 * 60;
1114
+
1115
+ default:
1116
+ return timeInterval.year * 365 * 24 * 60;
1117
+ }
1118
+
1119
+ case true:
1120
+ if (timeInterval.day !== 0) {
1121
+ return timeInterval.day * 24 * 60;
1122
+ }
1123
+
1124
+ if (timeInterval.hour !== 0) {
1125
+ return timeInterval.hour * 60;
1126
+ }
1127
+
1128
+ if (timeInterval.minute !== 0) {
1129
+ return timeInterval.minute;
1130
+ }
1131
+
1132
+ if (timeInterval.second !== 0) {
1133
+ return timeInterval.second / 60.0;
1134
+ }
1135
+
1136
+ return 5;
1137
+
1138
+ default:
1139
+ return 5;
1140
+ }
1141
+ };
1142
+ var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
1143
+ return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
1144
+ };
984
1145
 
985
1146
  var utils = /*#__PURE__*/Object.freeze({
986
1147
  __proto__: null,
@@ -990,7 +1151,9 @@
990
1151
  produceDraftStateSetWebMapDimension: produceDraftStateSetWebMapDimension,
991
1152
  findMapIdFromLayerId: findMapIdFromLayerId,
992
1153
  produceDraftStateSetMapDimensionFromLayerChangeDimension: produceDraftStateSetMapDimensionFromLayerChangeDimension,
993
- moveArrayElements: moveArrayElements
1154
+ moveArrayElements: moveArrayElements,
1155
+ getTimeStepFromDataInterval: getTimeStepFromDataInterval,
1156
+ getActiveLayerTimeStep: getActiveLayerTimeStep
994
1157
  });
995
1158
 
996
1159
  /* *
@@ -1552,6 +1715,17 @@
1552
1715
  var dimensionsAction = layerActions.layerSetDimensions(layerDimensions);
1553
1716
  var newState = layerDimensions === null ? intermediateState : reducer$6(intermediateState, dimensionsAction);
1554
1717
  return newState;
1718
+ },
1719
+ setSelectedFeature: function setSelectedFeature(draft, action) {
1720
+ var _a = action.payload,
1721
+ layerId = _a.layerId,
1722
+ selectedFeatureIndex = _a.selectedFeatureIndex;
1723
+
1724
+ if (!draft.byId[layerId]) {
1725
+ return;
1726
+ }
1727
+
1728
+ draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
1555
1729
  }
1556
1730
  },
1557
1731
  extraReducers: function extraReducers(builder) {
@@ -2155,17 +2329,6 @@
2155
2329
 
2156
2330
  draft.byId[mapId].animationEndTime = animationEndTime;
2157
2331
  },
2158
- setSelectedFeature: function setSelectedFeature(draft, action) {
2159
- var _a = action.payload,
2160
- mapId = _a.mapId,
2161
- selectedFeatureIndex = _a.selectedFeatureIndex;
2162
-
2163
- if (!draft.byId[mapId]) {
2164
- return;
2165
- }
2166
-
2167
- draft.byId[mapId].selectedFeatureIndex = selectedFeatureIndex;
2168
- },
2169
2332
  setAnimationDelay: function setAnimationDelay(draft, action) {
2170
2333
  var _a = action.payload,
2171
2334
  mapId = _a.mapId,
@@ -2334,41 +2497,6 @@
2334
2497
  }
2335
2498
 
2336
2499
  draft.byId[mapId].displayMapPin = displayMapPin;
2337
- },
2338
- setActiveMapPresetId: function setActiveMapPresetId(draft, action) {
2339
- var _a = action.payload,
2340
- mapId = _a.mapId,
2341
- presetId = _a.presetId;
2342
-
2343
- if (!draft.byId[mapId]) {
2344
- return;
2345
- }
2346
-
2347
- draft.byId[mapId].activeMapPresetId = presetId;
2348
- },
2349
- setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2350
- var _a = action.payload,
2351
- mapId = _a.mapId,
2352
- hasChanges = _a.hasChanges;
2353
-
2354
- if (!draft.byId[mapId]) {
2355
- return;
2356
- }
2357
-
2358
- draft.byId[mapId].hasMapPresetChanges = hasChanges;
2359
- },
2360
- toggleDockedLayerManager: function toggleDockedLayerManager(draft, action) {
2361
- var _a = action.payload,
2362
- mapId = _a.mapId,
2363
- openDockedLayerManager = _a.openDockedLayerManager;
2364
-
2365
- if (!draft.byId[mapId]) {
2366
- return;
2367
- }
2368
-
2369
- draft.byId[mapId].dockedLayerManager = {
2370
- isOpen: openDockedLayerManager
2371
- };
2372
2500
  }
2373
2501
  },
2374
2502
  extraReducers: function extraReducers(builder) {
@@ -2609,14 +2737,13 @@
2609
2737
  draft.byId[mapId].baseLayers = [];
2610
2738
  draft.byId[mapId].mapLayers = [];
2611
2739
  draft.byId[mapId].overLayers = [];
2612
- draft.byId[mapId].hasMapPresetChanges = false;
2613
2740
  draft.byId[mapId].isAutoUpdating = false;
2614
2741
  draft.byId[mapId].isAnimating = false;
2615
2742
  draft.byId[mapId].isTimeSliderVisible = true;
2616
2743
  draft.byId[mapId].isTimestepAuto = true;
2617
2744
  draft.byId[mapId].displayMapPin = false;
2618
2745
  draft.byId[mapId].shouldShowZoomControls = true;
2619
- draft.byId[mapId].timeStep = defaultTimeStep;
2746
+ draft.byId[mapId].timeStep = undefined;
2620
2747
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2621
2748
  }).addCase(uiActions.registerDialog, function (draft, action) {
2622
2749
  var _a = action.payload,
@@ -2733,7 +2860,7 @@
2733
2860
  * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
2734
2861
  */
2735
2862
 
2736
- toolkit.createSelector(getAllLayers, function (layers) {
2863
+ var getLayers = toolkit.createSelector(getAllLayers, function (layers) {
2737
2864
  return layers.filter(function (layer) {
2738
2865
  return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
2739
2866
  });
@@ -2746,7 +2873,7 @@
2746
2873
  * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
2747
2874
  */
2748
2875
 
2749
- toolkit.createSelector(getAllLayers, function (layers) {
2876
+ var getBaseLayers = toolkit.createSelector(getAllLayers, function (layers) {
2750
2877
  return layers.filter(function (layer) {
2751
2878
  return layer.layerType === LayerType.baseLayer;
2752
2879
  });
@@ -2759,7 +2886,7 @@
2759
2886
  * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
2760
2887
  */
2761
2888
 
2762
- toolkit.createSelector(getAllLayers, function (layers) {
2889
+ var getOverLayers = toolkit.createSelector(getAllLayers, function (layers) {
2763
2890
  return layers.filter(function (layer) {
2764
2891
  return layer.layerType === LayerType.overLayer;
2765
2892
  });
@@ -2888,7 +3015,7 @@
2888
3015
  * @returns {string} returnType: LayerStatus
2889
3016
  */
2890
3017
 
2891
- toolkit.createSelector(getLayerById, function (layer) {
3018
+ var getLayerStatus = toolkit.createSelector(getLayerById, function (layer) {
2892
3019
  return layer && layer.status ? layer.status : LayerStatus["default"];
2893
3020
  });
2894
3021
  /**
@@ -2916,6 +3043,68 @@
2916
3043
 
2917
3044
  return [];
2918
3045
  }, selectorMemoizationOptions);
3046
+ /**
3047
+ * Returns the selected geojson feature for the given layer
3048
+ *
3049
+ * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
3050
+ * @param {object} store store: object - store object
3051
+ * @param {string} mapId layerId: string - Id of the layer
3052
+ * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
3053
+ */
3054
+
3055
+ var getSelectedFeatureIndex = toolkit.createSelector(getLayerById, function (layer) {
3056
+ return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
3057
+ });
3058
+ /**
3059
+ * Gets layerIds that contain passed dimension
3060
+ *
3061
+ * Example: dimension = getDimensionLayerIds(store, 'elevation')
3062
+ * @param {object} store store: object - object from which the layers state will be extracted
3063
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3064
+ * @returns {string[]} returnType: string[] - layerIds
3065
+ */
3066
+
3067
+ var getDimensionLayerIds = toolkit.createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
3068
+ return dimensionName;
3069
+ }, function (layerIds, layers, dimensionName) {
3070
+ return layerIds.reduce(function (list, layerId) {
3071
+ var layer = layers[layerId];
3072
+ var dimensions = (layer === null || layer === void 0 ? void 0 : layer.dimensions) ? layer.dimensions : [];
3073
+
3074
+ if (dimensions.find(function (dimension) {
3075
+ return dimension.name === dimensionName;
3076
+ })) {
3077
+ return list.concat(layerId);
3078
+ }
3079
+
3080
+ return list;
3081
+ }, []);
3082
+ }, selectorMemoizationOptions);
3083
+
3084
+ var selectors$2 = /*#__PURE__*/Object.freeze({
3085
+ __proto__: null,
3086
+ getLayerById: getLayerById,
3087
+ getLayersById: getLayersById,
3088
+ getLayersIds: getLayersIds,
3089
+ getAllLayers: getAllLayers,
3090
+ getLayersByMapId: getLayersByMapId,
3091
+ getLayers: getLayers,
3092
+ getBaseLayers: getBaseLayers,
3093
+ getOverLayers: getOverLayers,
3094
+ getLayerDimensions: getLayerDimensions,
3095
+ getLayerNonTimeDimensions: getLayerNonTimeDimensions,
3096
+ getLayerTimeDimension: getLayerTimeDimension,
3097
+ getLayerDimension: getLayerDimension,
3098
+ getLayerOpacity: getLayerOpacity,
3099
+ getLayerEnabled: getLayerEnabled,
3100
+ getLayerName: getLayerName,
3101
+ getLayerService: getLayerService,
3102
+ getLayerStyle: getLayerStyle,
3103
+ getLayerStatus: getLayerStatus,
3104
+ getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
3105
+ getSelectedFeatureIndex: getSelectedFeatureIndex,
3106
+ getDimensionLayerIds: getDimensionLayerIds
3107
+ });
2919
3108
 
2920
3109
  /* *
2921
3110
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3867,7 +4056,12 @@
3867
4056
  */
3868
4057
 
3869
4058
  var getMapTimeStep = toolkit.createSelector(getMapById, function (store) {
3870
- return store ? store.timeStep : defaultTimeStep;
4059
+ var _a;
4060
+
4061
+ return (_a = store === null || store === void 0 ? void 0 : store.timeStep) !== null && _a !== void 0 ? _a : defaultTimeStep;
4062
+ });
4063
+ var getMapTimeStepWithoutDefault = toolkit.createSelector(getMapById, function (store) {
4064
+ return store === null || store === void 0 ? void 0 : store.timeStep;
3871
4065
  });
3872
4066
  /**
3873
4067
  * Returns the speed of animation
@@ -4114,7 +4308,7 @@
4114
4308
  return store ? store.disableMapPin : false;
4115
4309
  });
4116
4310
  /**
4117
- * Returns the diplay map pin boolean for the current map
4311
+ * Returns the display map pin boolean for the current map
4118
4312
  *
4119
4313
  * Example getDisplayMapPin(store);
4120
4314
  * @param {object} store store: object - store object
@@ -4125,30 +4319,6 @@
4125
4319
  var getDisplayMapPin = toolkit.createSelector(getMapById, function (store) {
4126
4320
  return store ? store.displayMapPin : false;
4127
4321
  });
4128
- /**
4129
- * Returns the selected geojson feature for the given map
4130
- *
4131
- * Example const selectedFeature = getSelectedFeature(store, 'mapId1')
4132
- * @param {object} store store: object - store object
4133
- * @param {string} mapId mapId: string - Id of the map
4134
- * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
4135
- */
4136
-
4137
- var getSelectedFeatureIndex = toolkit.createSelector(getMapById, function (store) {
4138
- return store === null || store === void 0 ? void 0 : store.selectedFeatureIndex;
4139
- });
4140
- /**
4141
- * Returns the active map preset id
4142
- *
4143
- * Example getActiveMapPresetId(store, mapId);
4144
- * @param {object} store store: object - store object
4145
- * @param {string} mapId mapId: string - Id of the map
4146
- * @returns {boolean} returnType: boolean or undefined
4147
- */
4148
-
4149
- var getActiveMapPresetId = toolkit.createSelector(getMapById, function (store) {
4150
- return store ? store.activeMapPresetId : undefined;
4151
- });
4152
4322
  /**
4153
4323
  * Returns the legend id
4154
4324
  *
@@ -4214,31 +4384,40 @@
4214
4384
  });
4215
4385
  }, selectorMemoizationOptions);
4216
4386
  /**
4217
- * Returns the has changes state of the map preset
4387
+ * Gets all enabled layerIds for map
4218
4388
  *
4219
- * Example getHasMapPresetChanges(store, mapId);
4220
- * @param {object} store store: object - store object
4389
+ * Example: getMapLayerIdsEnabled = getLayerIdsEnabled(store, 'mapId_1')
4390
+ * @param {object} store store: object - store
4221
4391
  * @param {string} mapId mapId: string - Id of the map
4222
- * @returns {boolean} returnType: boolean
4392
+ * @returns {string[]} returnType: string[] - array of enabled layerIds
4223
4393
  */
4224
4394
 
4225
- var getHasMapPresetChanges = toolkit.createSelector(getMapById, function (store) {
4226
- return store && store.hasMapPresetChanges ? store.hasMapPresetChanges : false;
4227
- });
4395
+ var getMapLayerIdsEnabled = toolkit.createSelector(getLayerIds, getLayersById, function (mapLayerIds, layers) {
4396
+ return mapLayerIds.reduce(function (list, layerId) {
4397
+ if (layers[layerId] && layers[layerId].enabled) {
4398
+ return list.concat(layerId);
4399
+ }
4400
+
4401
+ return list;
4402
+ }, []);
4403
+ }, selectorMemoizationOptions);
4228
4404
  /**
4229
- * Returns whether the docked layer manager is open
4405
+ * Returns if a map dimension is used for any enabled layers on that map
4230
4406
  *
4231
- * Example getIsDockedLayerManagerOpen(store, mapId);
4407
+ * Example getIsEnabledLayersForMapDimension(store, mapId);
4232
4408
  * @param {object} store store: object - store object
4233
4409
  * @param {string} mapId mapId: string - Id of the map
4410
+ * @param {string} dimensionName dimensionName: string - name of the dimension
4234
4411
  * @returns {Boolean} returnType: boolean
4235
4412
  */
4236
4413
 
4237
- var getIsDockedLayerManagerOpen = toolkit.createSelector(getMapById, function (store) {
4238
- var _a;
4239
-
4240
- return (_a = store === null || store === void 0 ? void 0 : store.dockedLayerManager) === null || _a === void 0 ? void 0 : _a.isOpen;
4241
- });
4414
+ var getIsEnabledLayersForMapDimension = toolkit.createSelector(getMapLayerIdsEnabled, function (store, _mapId, dimensionName) {
4415
+ return getDimensionLayerIds(store, dimensionName);
4416
+ }, function (enabledMapLayerIds, dimensionLayerIds) {
4417
+ return dimensionLayerIds.some(function (layerId) {
4418
+ return enabledMapLayerIds.includes(layerId);
4419
+ });
4420
+ }, selectorMemoizationOptions);
4242
4421
 
4243
4422
  var selectors = /*#__PURE__*/Object.freeze({
4244
4423
  __proto__: null,
@@ -4265,6 +4444,7 @@
4265
4444
  getActiveLayerId: getActiveLayerId,
4266
4445
  getMapTimeSliderScale: getMapTimeSliderScale,
4267
4446
  getMapTimeStep: getMapTimeStep,
4447
+ getMapTimeStepWithoutDefault: getMapTimeStepWithoutDefault,
4268
4448
  getMapAnimationDelay: getMapAnimationDelay,
4269
4449
  getMapTimeSliderCenterTime: getMapTimeSliderCenterTime,
4270
4450
  getTimeSliderUnfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime,
@@ -4283,12 +4463,10 @@
4283
4463
  getPinLocation: getPinLocation,
4284
4464
  getDisableMapPin: getDisableMapPin,
4285
4465
  getDisplayMapPin: getDisplayMapPin,
4286
- getSelectedFeatureIndex: getSelectedFeatureIndex,
4287
- getActiveMapPresetId: getActiveMapPresetId,
4288
4466
  getLegendId: getLegendId,
4289
4467
  getMapPreset: getMapPreset,
4290
- getHasMapPresetChanges: getHasMapPresetChanges,
4291
- getIsDockedLayerManagerOpen: getIsDockedLayerManagerOpen
4468
+ getMapLayerIdsEnabled: getMapLayerIdsEnabled,
4469
+ getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension
4292
4470
  });
4293
4471
 
4294
4472
  var DialogTypes;
@@ -4303,6 +4481,7 @@
4303
4481
  DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4304
4482
  DialogTypes["LayerManager"] = "layerManager";
4305
4483
  DialogTypes["LayerSelect"] = "layerSelect";
4484
+ DialogTypes["DockedLayerManager"] = "dockedLayerManager";
4306
4485
  })(DialogTypes || (DialogTypes = {}));
4307
4486
 
4308
4487
  var types = /*#__PURE__*/Object.freeze({
@@ -7986,12 +8165,12 @@
7986
8165
  });
7987
8166
  }
7988
8167
  function setLayerDimensionsSaga(_a) {
7989
- var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, error_1;
8168
+ var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, isActiveLayer, timeStep, newTimeStep, error_1;
7990
8169
  var payload = _a.payload;
7991
8170
  return __generator(this, function (_b) {
7992
8171
  switch (_b.label) {
7993
8172
  case 0:
7994
- _b.trys.push([0, 12,, 13]);
8173
+ _b.trys.push([0, 15,, 16]);
7995
8174
 
7996
8175
  layerDimensions = payload.layerDimensions;
7997
8176
  if (!layerDimensions) return [2
@@ -8036,13 +8215,40 @@
8036
8215
  case 5:
8037
8216
  isAnimating$1 = _b.sent();
8038
8217
  webmapInstance = getWMJSMapById(mapId);
8039
- if (!(layerId === activeLayerId && // only update the active layer
8218
+ isActiveLayer = layerId === activeLayerId;
8219
+ return [4
8220
+ /*yield*/
8221
+ , effects.select(getMapTimeStepWithoutDefault, mapId)];
8222
+
8223
+ case 6:
8224
+ timeStep = _b.sent();
8225
+ if (!(isActiveLayer && timeStep === undefined && newTimeDimension)) return [3
8226
+ /*break*/
8227
+ , 8];
8228
+ newTimeStep = getActiveLayerTimeStep(newTimeDimension);
8229
+ if (!newTimeStep) return [3
8230
+ /*break*/
8231
+ , 8];
8232
+ return [4
8233
+ /*yield*/
8234
+ , effects.put(mapActions$1.setTimeStep({
8235
+ mapId: mapId,
8236
+ timeStep: newTimeStep
8237
+ }))];
8238
+
8239
+ case 7:
8240
+ _b.sent();
8241
+
8242
+ _b.label = 8;
8243
+
8244
+ case 8:
8245
+ if (!(isActiveLayer && // only update the active layer
8040
8246
  shouldAutoUpdate && newTimeDimension && newTimeDimension.maxValue && prevTimeDimension && prevTimeDimension.currentValue && prevTimeDimension.currentValue !== newTimeDimension.maxValue)) return [3
8041
8247
  /*break*/
8042
- , 9];
8248
+ , 12];
8043
8249
  if (!!isAnimating$1) return [3
8044
8250
  /*break*/
8045
- , 7];
8251
+ , 10];
8046
8252
  return [4
8047
8253
  /*yield*/
8048
8254
  , effects.put(layerActions.layerChangeDimension({
@@ -8054,50 +8260,50 @@
8054
8260
  }
8055
8261
  }))];
8056
8262
 
8057
- case 6:
8263
+ case 9:
8058
8264
  _b.sent();
8059
8265
 
8060
- _b.label = 7;
8266
+ _b.label = 10;
8061
8267
 
8062
- case 7:
8268
+ case 10:
8063
8269
  return [4
8064
8270
  /*yield*/
8065
8271
  , effects.call(updateAnimation, mapId, newTimeDimension.maxValue)];
8066
8272
 
8067
- case 8:
8273
+ case 11:
8068
8274
  _b.sent();
8069
8275
 
8070
8276
  return [3
8071
8277
  /*break*/
8072
- , 11];
8278
+ , 14];
8073
8279
 
8074
- case 9:
8280
+ case 12:
8075
8281
  if (!(isAnimating$1 && !webmapInstance.isAnimating && newTimeDimension && newTimeDimension.maxValue)) return [3
8076
8282
  /*break*/
8077
- , 11];
8283
+ , 14];
8078
8284
  return [4
8079
8285
  /*yield*/
8080
8286
  , effects.call(updateAnimation, mapId, newTimeDimension.maxValue)];
8081
8287
 
8082
- case 10:
8288
+ case 13:
8083
8289
  _b.sent();
8084
8290
 
8085
- _b.label = 11;
8291
+ _b.label = 14;
8086
8292
 
8087
- case 11:
8293
+ case 14:
8088
8294
  return [3
8089
8295
  /*break*/
8090
- , 13];
8296
+ , 16];
8091
8297
 
8092
- case 12:
8298
+ case 15:
8093
8299
  error_1 = _b.sent(); // eslint-disable-next-line no-console
8094
8300
 
8095
8301
  console.warn(error_1);
8096
8302
  return [3
8097
8303
  /*break*/
8098
- , 13];
8304
+ , 16];
8099
8305
 
8100
- case 13:
8306
+ case 16:
8101
8307
  return [2
8102
8308
  /*return*/
8103
8309
  ];
@@ -8516,54 +8722,6 @@
8516
8722
  }
8517
8723
  });
8518
8724
  }
8519
- 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];
8520
- var supportedChangeOrigins = [LayerActionOrigin.layerManager, LayerActionOrigin.wmsLoader, MapActionOrigin.map];
8521
- function checkMapPresetForChangesSaga(action) {
8522
- var _a, mapId, origin, isChangeOriginSupported, hasMapPresetChanges;
8523
-
8524
- return __generator(this, function (_b) {
8525
- switch (_b.label) {
8526
- case 0:
8527
- _a = action.payload, mapId = _a.mapId, origin = _a.origin;
8528
-
8529
- if (!origin) {
8530
- return [2
8531
- /*return*/
8532
- ];
8533
- }
8534
-
8535
- isChangeOriginSupported = supportedChangeOrigins.indexOf(origin) >= 0;
8536
- if (!isChangeOriginSupported) return [3
8537
- /*break*/
8538
- , 3];
8539
- return [4
8540
- /*yield*/
8541
- , effects.select(getHasMapPresetChanges, mapId)];
8542
-
8543
- case 1:
8544
- hasMapPresetChanges = _b.sent();
8545
- if (!!hasMapPresetChanges) return [3
8546
- /*break*/
8547
- , 3];
8548
- return [4
8549
- /*yield*/
8550
- , effects.put(mapActions$1.setHasMapPresetChanges({
8551
- mapId: mapId,
8552
- hasChanges: true
8553
- }))];
8554
-
8555
- case 2:
8556
- _b.sent();
8557
-
8558
- _b.label = 3;
8559
-
8560
- case 3:
8561
- return [2
8562
- /*return*/
8563
- ];
8564
- }
8565
- });
8566
- }
8567
8725
  function unregisterMapSaga(_a) {
8568
8726
  var mapId, layerList;
8569
8727
  var payload = _a.payload;
@@ -8604,7 +8762,7 @@
8604
8762
  // resets WMJSMap state
8605
8763
  return [4
8606
8764
  /*yield*/
8607
- , effects.all([effects.takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga), effects.takeLatest(mapActions$1.setActiveMapPresetId.type, stopAnimationSaga)])];
8765
+ , effects.takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga)];
8608
8766
 
8609
8767
  case 1:
8610
8768
  // resets WMJSMap state
@@ -8645,20 +8803,11 @@
8645
8803
  case 6:
8646
8804
  _a.sent();
8647
8805
 
8648
- return [4
8649
- /*yield*/
8650
- , effects.all(mapPresetChangeActions.map(function (action) {
8651
- return effects.takeEvery(action, checkMapPresetForChangesSaga);
8652
- }))];
8653
-
8654
- case 7:
8655
- _a.sent();
8656
-
8657
8806
  return [4
8658
8807
  /*yield*/
8659
8808
  , effects.takeEvery(mapActions$1.unregisterMap.type, unregisterMapSaga)];
8660
8809
 
8661
- case 8:
8810
+ case 7:
8662
8811
  _a.sent();
8663
8812
 
8664
8813
  return [2
@@ -12454,7 +12603,6 @@
12454
12603
  }));
12455
12604
  }
12456
12605
  }),
12457
- hasElevation: !isDockedLayerManager,
12458
12606
  className: "layermanager",
12459
12607
  sx: layerManagerStyle,
12460
12608
  onResizeStop: function onResizeStop(_event, _direction, node) {
@@ -12524,7 +12672,11 @@
12524
12672
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12525
12673
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12526
12674
  * */
12527
- var useSetupDialog = function useSetupDialog(dialogType) {
12675
+ var useSetupDialog = function useSetupDialog(dialogType, source) {
12676
+ if (source === void 0) {
12677
+ source = 'app';
12678
+ }
12679
+
12528
12680
  var dispatch = reactRedux.useDispatch();
12529
12681
  var onCloseDialog = React.useCallback(function () {
12530
12682
  dispatch(uiActions.setToggleOpenDialog({
@@ -12547,9 +12699,10 @@
12547
12699
  var registerDialog = React.useCallback(function () {
12548
12700
  dispatch(uiActions.registerDialog({
12549
12701
  type: dialogType,
12550
- setOpen: false
12702
+ setOpen: false,
12703
+ source: source
12551
12704
  }));
12552
- }, [dialogType, dispatch]);
12705
+ }, [dialogType, dispatch, source]);
12553
12706
  var unregisterDialog = React.useCallback(function () {
12554
12707
  dispatch(uiActions.unregisterDialog({
12555
12708
  type: dialogType
@@ -12733,9 +12886,9 @@
12733
12886
  var onToggleDock = function onToggleDock() {
12734
12887
  // Close the floating layer manager and open docked layer manager
12735
12888
  onCloseDialog();
12736
- dispatch(mapActions$1.toggleDockedLayerManager({
12737
- mapId: mapId,
12738
- openDockedLayerManager: true
12889
+ dispatch(uiActions.setToggleOpenDialog({
12890
+ type: DialogTypes.DockedLayerManager + "-" + mapId,
12891
+ setOpen: true
12739
12892
  }));
12740
12893
  };
12741
12894
 
@@ -12789,7 +12942,9 @@
12789
12942
  _b = _a.showTitle,
12790
12943
  showTitle = _b === void 0 ? false : _b,
12791
12944
  _c = _a.leftHeaderComponent,
12792
- leftHeaderComponent = _c === void 0 ? undefined : _c;
12945
+ leftHeaderComponent = _c === void 0 ? undefined : _c,
12946
+ _d = _a.source,
12947
+ source = _d === void 0 ? 'app' : _d;
12793
12948
  var dispatch = reactRedux.useDispatch(); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12794
12949
  // const isMapPresetLoading = useSelector((store: AppStore) =>
12795
12950
  // mapSelectors.getIsMapPresetLoading(store, mapId),
@@ -12798,26 +12953,22 @@
12798
12953
  // mapSelectors.getMapPresetError(store, mapId),
12799
12954
  // );
12800
12955
 
12801
- var isDockedLayerManagerOpen = reactRedux.useSelector(function (store) {
12802
- return getIsDockedLayerManagerOpen(store, mapId);
12803
- });
12956
+ var dialogType = DialogTypes.DockedLayerManager + "-" + mapId;
12804
12957
 
12805
- var onClose = function onClose() {
12806
- // Open docked layer manager and close the floating layer manager
12807
- dispatch(mapActions$1.toggleDockedLayerManager({
12808
- mapId: mapId,
12809
- openDockedLayerManager: false
12810
- }));
12811
- };
12958
+ var _e = useSetupDialog(dialogType, source),
12959
+ dialogOrder = _e.dialogOrder,
12960
+ isDialogOpen = _e.isDialogOpen,
12961
+ setDialogOrder = _e.setDialogOrder,
12962
+ onCloseDialog = _e.onCloseDialog;
12812
12963
 
12813
12964
  var onToggleDock = function onToggleDock() {
12814
12965
  // Close docked layer manager and open the floating layer manager
12815
- onClose();
12966
+ onCloseDialog();
12816
12967
  dispatch(uiActions.setActiveMapIdForDialog({
12817
12968
  type: DialogTypes.LayerManager,
12818
12969
  mapId: mapId,
12819
12970
  setOpen: true,
12820
- source: 'app'
12971
+ source: source
12821
12972
  }));
12822
12973
  };
12823
12974
 
@@ -12826,8 +12977,8 @@
12826
12977
  preloadedAvailableBaseLayers: preloadedAvailableBaseLayers,
12827
12978
  preloadedBaseServices: preloadedBaseServices,
12828
12979
  bounds: bounds,
12829
- isOpen: isDockedLayerManagerOpen,
12830
- onClose: onClose,
12980
+ isOpen: isDialogOpen,
12981
+ onClose: onCloseDialog,
12831
12982
  showTitle: showTitle,
12832
12983
  leftHeaderComponent: leftHeaderComponent,
12833
12984
  // isLoading={isMapPresetLoading}
@@ -12838,7 +12989,10 @@
12838
12989
  startPosition: {
12839
12990
  top: 60,
12840
12991
  right: 16
12841
- }
12992
+ },
12993
+ onMouseDown: setDialogOrder,
12994
+ order: dialogOrder,
12995
+ source: source
12842
12996
  });
12843
12997
  };
12844
12998
 
@@ -16344,8 +16498,8 @@
16344
16498
  _d = _a.source,
16345
16499
  source = _d === void 0 ? 'app' : _d;
16346
16500
  var dispatch = reactRedux.useDispatch();
16347
- var mapDimension = reactRedux.useSelector(function (store) {
16348
- return getMapDimension(store, mapId, dimensionName);
16501
+ var mapContainsDimension = reactRedux.useSelector(function (store) {
16502
+ return getIsEnabledLayersForMapDimension(store, mapId, dimensionName);
16349
16503
  });
16350
16504
  var layerIds = reactRedux.useSelector(function (store) {
16351
16505
  return getLayerIds(store, mapId);
@@ -16373,7 +16527,7 @@
16373
16527
  }));
16374
16528
  }, [dispatch]);
16375
16529
 
16376
- if (!mapDimension || !layerIds || layerIds.length < 1) {
16530
+ if (!mapContainsDimension || !layerIds || layerIds.length < 1) {
16377
16531
  return null;
16378
16532
  }
16379
16533
 
@@ -16493,6 +16647,10 @@
16493
16647
  });
16494
16648
  var isOpenInStore = reactRedux.useSelector(function (store) {
16495
16649
  return getisDialogOpen(store, uiDialogType);
16650
+ }); // Only show button if enabled layer for map contains dimension
16651
+
16652
+ var mapContainsDimension = reactRedux.useSelector(function (store) {
16653
+ return getIsEnabledLayersForMapDimension(store, mapId, dimension);
16496
16654
  });
16497
16655
  var openMultiDimensionDialog = React__namespace.useCallback(function () {
16498
16656
  var setOpen = currentActiveMapId !== mapId ? true : !isOpenInStore;
@@ -16503,6 +16661,11 @@
16503
16661
  source: source
16504
16662
  }));
16505
16663
  }, [currentActiveMapId, dispatch, isOpenInStore, uiDialogType, mapId, source]);
16664
+
16665
+ if (!mapContainsDimension) {
16666
+ return null;
16667
+ }
16668
+
16506
16669
  var isOpen = currentActiveMapId === mapId && isOpenInStore;
16507
16670
  return /*#__PURE__*/React__namespace.createElement(DimensionSelectButton, {
16508
16671
  dimension: dimension,
@@ -16662,7 +16825,8 @@
16662
16825
  title = _a.title,
16663
16826
  icon = _a.icon,
16664
16827
  _b = _a.onChangeMouseWheel,
16665
- onChangeMouseWheel = _b === void 0 ? function () {} : _b;
16828
+ onChangeMouseWheel = _b === void 0 ? function () {} : _b,
16829
+ animationLength = _a.animationLength;
16666
16830
  var currentMarkIndex = marks.findIndex(function (mark) {
16667
16831
  return mark.value === value;
16668
16832
  });
@@ -16752,7 +16916,22 @@
16752
16916
  },
16753
16917
  selected: isAutoSelected,
16754
16918
  disabled: isDisabled
16755
- }, "Auto")));
16919
+ }, "Auto"), animationLength && /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
16920
+ disabled: true,
16921
+ sx: {
16922
+ fontSize: '12px',
16923
+ opacity: 0.67,
16924
+ padding: '0px 12px',
16925
+ '&.MuiMenuItem-root': {
16926
+ minHeight: '30px!important'
16927
+ }
16928
+ }
16929
+ }, "length"), animationLength && /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
16930
+ "data-testid": "menu-animation-length-button",
16931
+ active: false,
16932
+ disableRipple: true,
16933
+ width: "100%"
16934
+ }, minutesToDescribedDuration(animationLength))));
16756
16935
  };
16757
16936
 
16758
16937
  /* *
@@ -16911,13 +17090,12 @@
16911
17090
  var timeStep = _a.timeStep,
16912
17091
  _b = _a.disabled,
16913
17092
  disabled = _b === void 0 ? false : _b,
16914
- _c = _a.isTimestepAuto,
16915
- isTimestepAuto = _c === void 0 ? false : _c,
17093
+ isTimestepAuto = _a.isTimestepAuto,
16916
17094
  onChangeTimeStep = _a.onChangeTimeStep,
16917
- _d = _a.onToggleTimestepAuto,
16918
- onToggleTimestepAuto = _d === void 0 ? function () {} : _d,
16919
- _e = _a.isOpenByDefault,
16920
- isOpenByDefault = _e === void 0 ? false : _e;
17095
+ _c = _a.onToggleTimestepAuto,
17096
+ onToggleTimestepAuto = _c === void 0 ? function () {} : _c,
17097
+ _d = _a.isOpenByDefault,
17098
+ isOpenByDefault = _d === void 0 ? false : _d;
16921
17099
 
16922
17100
  var handleMenuItemClick = function handleMenuItemClick(mark) {
16923
17101
  if (isTimestepAuto) {
@@ -17121,6 +17299,7 @@
17121
17299
  disabled = _b === void 0 ? false : _b,
17122
17300
  _c = _a.animationLength,
17123
17301
  animationLength = _c === void 0 ? AnimationLength.Hours1 : _c,
17302
+ animationLengthInMinutes = _a.animationLengthInMinutes,
17124
17303
  onChangeAnimationLength = _a.onChangeAnimationLength;
17125
17304
 
17126
17305
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -17139,7 +17318,8 @@
17139
17318
  title: title,
17140
17319
  isDisabled: disabled,
17141
17320
  value: animationLength,
17142
- onChangeMouseWheel: onChangeSliderValue
17321
+ onChangeMouseWheel: onChangeSliderValue,
17322
+ animationLength: animationLengthInMinutes
17143
17323
  });
17144
17324
  };
17145
17325
 
@@ -17188,7 +17368,8 @@
17188
17368
  xs: "auto"
17189
17369
  }, timeStepBtn || /*#__PURE__*/React__default["default"].createElement(TimeStepButton, {
17190
17370
  timeStep: 0,
17191
- onChangeTimeStep: function onChangeTimeStep() {}
17371
+ onChangeTimeStep: function onChangeTimeStep() {},
17372
+ isTimestepAuto: false
17192
17373
  })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
17193
17374
  item: true,
17194
17375
  xs: "auto"
@@ -17226,32 +17407,21 @@
17226
17407
  timeScaleBtn = _a.timeScaleBtn,
17227
17408
  animationLengthBtn = _a.animationLengthBtn,
17228
17409
  _b = _a.isOpenByDefault,
17229
- isOpenByDefault = _b === void 0 ? false : _b,
17230
- timeStep = _a.timeStep,
17231
- timeDimension = _a.timeDimension,
17232
- onChangeTimeStep = _a.onChangeTimeStep,
17233
- _c = _a.isTimestepAuto,
17234
- isTimestepAuto = _c === void 0 ? false : _c;
17410
+ isOpenByDefault = _b === void 0 ? false : _b;
17235
17411
 
17236
- var _d = __read(React.useState(null), 2),
17237
- anchorEl = _d[0],
17238
- setAnchorEl = _d[1];
17412
+ var _c = __read(React.useState(null), 2),
17413
+ anchorEl = _c[0],
17414
+ setAnchorEl = _c[1];
17239
17415
 
17240
- var _e = __read(React.useState(false), 2),
17241
- open = _e[0],
17242
- setOpen = _e[1];
17416
+ var _d = __read(React.useState(false), 2),
17417
+ open = _d[0],
17418
+ setOpen = _d[1];
17243
17419
 
17244
17420
  React.useEffect(function () {
17245
17421
  if (anchorEl && isOpenByDefault) {
17246
17422
  setOpen(true);
17247
17423
  }
17248
17424
  }, [anchorEl, isOpenByDefault]);
17249
- var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
17250
- React__default["default"].useEffect(function () {
17251
- if (isTimestepAuto) {
17252
- onChangeTimeStep(timeStepFromLayer);
17253
- }
17254
- }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
17255
17425
  return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(shared.CustomTooltip, {
17256
17426
  title: "Animation options",
17257
17427
  placement: "bottom"
@@ -18323,95 +18493,114 @@
18323
18493
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
18324
18494
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
18325
18495
  * */
18496
+ var TIME_SLIDER_LEGEND_HEIGHT = 24;
18326
18497
  var DRAG_AREA_WIDTH = 24;
18327
18498
 
18328
- var TimeSliderLegend = function TimeSliderLegend(_a) {
18329
- var mapId = _a.mapId,
18330
- centerTime = _a.centerTime,
18331
- secondsPerPx = _a.secondsPerPx,
18332
- _b = _a.dataScaleToSecondsPerPx,
18333
- dataScaleToSecondsPerPx = _b === void 0 ? defaultDataScaleToSecondsPerPx : _b,
18334
- selectedTime = _a.selectedTime,
18335
- _c = _a.scale,
18336
- scale = _c === void 0 ? Scale.Hour : _c,
18337
- currentTime = _a.currentTime,
18338
- dataStartTime = _a.dataStartTime,
18339
- dataEndTime = _a.dataEndTime,
18340
- animationStartTime = _a.animationStartTime,
18341
- animationEndTime = _a.animationEndTime,
18342
- timeStep = _a.timeStep,
18343
- _d = _a.mapIsActive,
18344
- mapIsActive = _d === void 0 ? true : _d,
18345
- unfilteredSelectedTime = _a.unfilteredSelectedTime,
18346
- setUnfilteredSelectedTime = _a.setUnfilteredSelectedTime,
18347
- onSetNewDate = _a.onSetNewDate,
18348
- onSetCenterTime = _a.onSetCenterTime,
18349
- onSetAnimationStartTime = _a.onSetAnimationStartTime,
18350
- onSetAnimationEndTime = _a.onSetAnimationEndTime;
18351
-
18352
- var _e = __read(useCanvasTarget('mousedown'), 2),
18353
- node = _e[1];
18499
+ function useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition) {
18500
+ var _a = __read(React__namespace.useState(convertStringTimeToUnix(animationStartTime)), 2),
18501
+ localAnimationStartTime = _a[0],
18502
+ setLocalAnimationStartTime = _a[1];
18354
18503
 
18355
- var _f = __read(React__namespace.useState(0), 2),
18356
- canvasWidth = _f[0],
18357
- setCanvasWidth = _f[1];
18504
+ var _b = __read(React__namespace.useState(convertStringTimeToUnix(animationEndTime)), 2),
18505
+ localAnimationEndTime = _b[0],
18506
+ setLocalAnimationEndTime = _b[1];
18358
18507
 
18359
- var _g = __read(React__namespace.useState(false), 2),
18360
- selectedTimeDragging = _g[0],
18361
- setSelectedTimeDragging = _g[1];
18508
+ React__namespace.useEffect(function () {
18509
+ setLocalAnimationStartTime(convertStringTimeToUnix(animationStartTime));
18510
+ setLocalAnimationEndTime(convertStringTimeToUnix(animationEndTime));
18511
+ }, [animationStartTime, animationEndTime]);
18512
+ var animationDiff = React__namespace.useRef();
18513
+ var pixelsMovedSinceStartDragging = React__namespace.useRef(0);
18514
+ React__namespace.useEffect(function () {
18515
+ var handleMouseUp = function handleMouseUp() {
18516
+ pixelsMovedSinceStartDragging.current = 0;
18517
+ animationDiff.current = undefined;
18518
+ };
18362
18519
 
18363
- var _h = __read(React__namespace.useState(false), 2),
18364
- leftMarkerDragging = _h[0],
18365
- setLeftMarkerDragging = _h[1];
18520
+ document.addEventListener('mouseup', handleMouseUp);
18521
+ return function () {
18522
+ document.removeEventListener('mouseup', handleMouseUp);
18523
+ };
18524
+ }, []);
18525
+ React__namespace.useEffect(function () {
18526
+ var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
18366
18527
 
18367
- var _j = __read(React__namespace.useState(false), 2),
18368
- rightMarkerDragging = _j[0],
18369
- setRightMarkerDragging = _j[1];
18528
+ if (stoppedDragging) {
18529
+ if (localAnimationStartTime && localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
18530
+ onSetAnimationStartTime(moment__default["default"].utc(localAnimationStartTime * 1000).format(dateFormat));
18531
+ }
18370
18532
 
18371
- var _k = __read(React__namespace.useState(false), 2),
18372
- centerTimeDragging = _k[0],
18373
- setCenterTimeDragging = _k[1];
18533
+ if (localAnimationEndTime && localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
18534
+ onSetAnimationEndTime(moment__default["default"].utc(localAnimationEndTime * 1000).format(dateFormat));
18535
+ }
18536
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
18374
18537
 
18375
- var _l = __read(React__namespace.useState(false), 2),
18376
- dragTooltipOpen = _l[0],
18377
- setDragTooltipOpen = _l[1];
18538
+ }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
18539
+ var handleAnimationDragging = React.useCallback(function (x) {
18540
+ if (!localAnimationStartTime || !localAnimationEndTime) return;
18378
18541
 
18379
- var _m = __read(React__namespace.useState(false), 2),
18380
- mouseDownInLegend = _m[0],
18381
- setMouseDownInLegend = _m[1];
18542
+ var _a = __read([localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
18543
+ return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
18544
+ }), 2),
18545
+ leftMarkerPx = _a[0],
18546
+ rightMarkerPx = _a[1];
18382
18547
 
18383
- var _o = __read(React__namespace.useState(animationStartTime && moment__default["default"].utc(animationStartTime).unix()), 2),
18384
- localAnimationStartTime = _o[0],
18385
- setLocalAnimationStartTime = _o[1];
18548
+ if (leftMarkerDragging) {
18549
+ var mousePosition = leftMarkerPx + x;
18550
+ var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2;
18551
+ if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // eslint-disable-next-line no-param-reassign
18386
18552
 
18387
- var _p = __read(React__namespace.useState(animationEndTime && moment__default["default"].utc(animationEndTime).unix()), 2),
18388
- localAnimationEndTime = _p[0],
18389
- setLocalAnimationEndTime = _p[1];
18553
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
18554
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
18555
+ setLocalAnimationStartTime(mouseTimeUnix);
18556
+ setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18557
+ return;
18558
+ }
18390
18559
 
18391
- var _q = __read(React__namespace.useState(moment__default["default"].utc(0)), 2),
18392
- tooltipTime = _q[0],
18393
- setTooltipTime = _q[1];
18560
+ if (rightMarkerDragging) {
18561
+ var mousePosition = rightMarkerPx + x;
18562
+ var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2;
18563
+ if (leftAnimationPosition >= mousePosition || mousePosition >= canvasWidth) return; // eslint-disable-next-line no-param-reassign
18394
18564
 
18395
- var _r = __read(React__namespace.useState(false), 2),
18396
- animationAreaDragging = _r[0],
18397
- setAnimationAreaDragging = _r[1];
18565
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
18566
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
18567
+ setLocalAnimationEndTime(mouseTimeUnix);
18568
+ setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18569
+ return;
18570
+ }
18398
18571
 
18399
- var animationDiff = React__namespace.useRef();
18400
- var isClickOrDrag = React__namespace.useRef();
18401
- var pixelsMovedSinceStartDragging = React__namespace.useRef(0);
18402
- var elem = document.querySelector(".timeSliderLegend_" + mapId);
18403
- var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left'];
18404
- var pixelsToTop = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['top'];
18572
+ if (animationAreaDragging) {
18573
+ if (animationDiff.current === undefined) {
18574
+ var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
18575
+ var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
18576
+ var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
18577
+ animationDiff.current = {
18578
+ diffStartToRight: diffRightAnimationToStartDraggingPosition,
18579
+ diffStartToLeft: diffLeftAnimationToStartDraggingPosition
18580
+ };
18581
+ return;
18582
+ }
18405
18583
 
18406
- var _s = __read(React__namespace.useState('auto'), 2),
18407
- cursorStyle = _s[0],
18408
- setCursorStyle = _s[1];
18584
+ pixelsMovedSinceStartDragging.current += x;
18585
+ var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
18586
+ var _b = animationDiff.current,
18587
+ diffStartToRight = _b.diffStartToRight,
18588
+ diffStartToLeft = _b.diffStartToLeft;
18589
+ var startTime = currentPositionTimestamp - diffStartToLeft;
18590
+ var endTime = currentPositionTimestamp + diffStartToRight;
18591
+ setLocalAnimationStartTime(startTime);
18592
+ setLocalAnimationEndTime(endTime);
18593
+ }
18594
+ }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition]);
18595
+ return {
18596
+ handleAnimationDragging: handleAnimationDragging,
18597
+ localAnimationEndTime: localAnimationEndTime,
18598
+ localAnimationStartTime: localAnimationStartTime
18599
+ };
18600
+ }
18409
18601
 
18602
+ function useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime) {
18410
18603
  var curTime = selectedTime !== undefined ? moment__default["default"].unix(selectedTime).toISOString() : moment__default["default"].utc().toISOString();
18411
- React__namespace.useEffect(function () {
18412
- setLocalAnimationStartTime(animationStartTime && moment__default["default"].utc(animationStartTime).unix());
18413
- setLocalAnimationEndTime(animationEndTime && moment__default["default"].utc(animationEndTime).unix());
18414
- }, [animationStartTime, animationEndTime]);
18415
18604
  React__namespace.useEffect(function () {
18416
18605
  var handleKeyDown = function handleKeyDown(event) {
18417
18606
  if (event.key === 'Home' && mapIsActive) {
@@ -18436,94 +18625,114 @@
18436
18625
  document.removeEventListener('keydown', handleKeyDown);
18437
18626
  };
18438
18627
  }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
18628
+ }
18629
+
18630
+ function convertStringTimeToUnix(time) {
18631
+ return time ? moment__default["default"].utc(time).unix() : undefined;
18632
+ } // Explanation of props can be found here:
18633
+ // https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
18634
+
18635
+
18636
+ var TimeSliderLegend = function TimeSliderLegend(_a) {
18637
+ var mapId = _a.mapId,
18638
+ centerTime = _a.centerTime,
18639
+ secondsPerPx = _a.secondsPerPx,
18640
+ _b = _a.dataScaleToSecondsPerPx,
18641
+ dataScaleToSecondsPerPx = _b === void 0 ? defaultDataScaleToSecondsPerPx : _b,
18642
+ selectedTime = _a.selectedTime,
18643
+ _c = _a.scale,
18644
+ scale = _c === void 0 ? Scale.Hour : _c,
18645
+ currentTime = _a.currentTime,
18646
+ dataStartTime = _a.dataStartTime,
18647
+ dataEndTime = _a.dataEndTime,
18648
+ animationStartTime = _a.animationStartTime,
18649
+ animationEndTime = _a.animationEndTime,
18650
+ timeStep = _a.timeStep,
18651
+ _d = _a.mapIsActive,
18652
+ mapIsActive = _d === void 0 ? true : _d,
18653
+ unfilteredSelectedTime = _a.unfilteredSelectedTime,
18654
+ setUnfilteredSelectedTime = _a.setUnfilteredSelectedTime,
18655
+ _e = _a.onSetNewDate,
18656
+ onSetNewDate = _e === void 0 ? function () {} : _e,
18657
+ _f = _a.onSetCenterTime,
18658
+ onSetCenterTime = _f === void 0 ? function () {} : _f,
18659
+ _g = _a.onSetAnimationStartTime,
18660
+ onSetAnimationStartTime = _g === void 0 ? function () {} : _g,
18661
+ _h = _a.onSetAnimationEndTime,
18662
+ onSetAnimationEndTime = _h === void 0 ? function () {} : _h;
18663
+ useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime);
18664
+
18665
+ var _j = __read(useCanvasTarget('mousedown'), 2),
18666
+ node = _j[1];
18667
+
18668
+ var _k = __read(React__namespace.useState(0), 2),
18669
+ canvasWidth = _k[0],
18670
+ setCanvasWidth = _k[1];
18671
+
18672
+ var _l = __read(React__namespace.useState(false), 2),
18673
+ selectedTimeDragging = _l[0],
18674
+ setSelectedTimeDragging = _l[1];
18675
+
18676
+ var _m = __read(React__namespace.useState(false), 2),
18677
+ leftMarkerDragging = _m[0],
18678
+ setLeftMarkerDragging = _m[1];
18679
+
18680
+ var _o = __read(React__namespace.useState(false), 2),
18681
+ rightMarkerDragging = _o[0],
18682
+ setRightMarkerDragging = _o[1];
18683
+
18684
+ var _p = __read(React__namespace.useState(false), 2),
18685
+ dragTooltipOpen = _p[0],
18686
+ setDragTooltipOpen = _p[1];
18687
+
18688
+ var _q = __read(React__namespace.useState(false), 2),
18689
+ mouseDownInLegend = _q[0],
18690
+ setMouseDownInLegend = _q[1];
18691
+
18692
+ var _r = __read(React__namespace.useState(false), 2),
18693
+ animationAreaDragging = _r[0],
18694
+ setAnimationAreaDragging = _r[1];
18695
+
18696
+ var _s = __read(React__namespace.useState('auto'), 2),
18697
+ cursorStyle = _s[0],
18698
+ setCursorStyle = _s[1];
18439
18699
  /**
18440
18700
  * remove active drag. can happen outside canvas.
18441
18701
  */
18442
18702
 
18703
+
18443
18704
  React__namespace.useEffect(function () {
18444
18705
  var handleMouseUp = function handleMouseUp() {
18445
- centerTimeDragging ? setCursorStyle('auto') : setCursorStyle('ew-resize');
18706
+ setCursorStyle('auto');
18446
18707
  setSelectedTimeDragging(false);
18447
18708
  setLeftMarkerDragging(false);
18448
18709
  setRightMarkerDragging(false);
18449
18710
  setMouseDownInLegend(false);
18450
- setCenterTimeDragging(false);
18451
18711
  setDragTooltipOpen(false);
18452
18712
  setAnimationAreaDragging(false);
18453
18713
  startDraggingPosition.current = 0;
18454
- pixelsMovedSinceStartDragging.current = 0;
18455
- animationDiff.current = undefined;
18456
18714
  };
18457
18715
 
18458
18716
  document.addEventListener('mouseup', handleMouseUp);
18459
18717
  return function () {
18460
18718
  document.removeEventListener('mouseup', handleMouseUp);
18461
18719
  };
18462
- }, [centerTimeDragging]);
18463
- var onMouseTouchMoveActions = React.useCallback(function (x) {
18464
- if (!localAnimationStartTime || !localAnimationEndTime) return;
18465
-
18466
- var _a = __read([localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
18467
- return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
18468
- }), 2),
18469
- leftMarkerPx = _a[0],
18470
- rightMarkerPx = _a[1];
18471
-
18472
- if (leftMarkerDragging) {
18473
- var mousePosition = leftMarkerPx + x;
18474
- var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2; // update tooltip position while dragging
18475
- // Prevent dragging if it would cause markers to cross over, except if the markers
18476
- // are moved away from being crossed over
18477
-
18478
- if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // set animation drag info dialog location
18479
-
18480
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
18481
-
18482
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
18483
- centerTime, canvasWidth, secondsPerPx);
18484
- setLocalAnimationStartTime(mouseTimeUnix);
18485
- setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18486
- return;
18487
- }
18488
-
18489
- if (rightMarkerDragging) {
18490
- var mousePosition = rightMarkerPx + x;
18491
- var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2; // Similar condition for other marker
18492
-
18493
- if (leftAnimationPosition >= mousePosition || mousePosition >= canvasWidth) return; // set animation drag info dialog location
18720
+ }, []);
18721
+ var dragTooltipPosition = React__namespace.useRef();
18722
+ var startDraggingPosition = React__namespace.useRef(0);
18723
+ var timeSliderLegendId = "timeSliderLegend_" + mapId;
18724
+ var timeSliderLegendElement = document.querySelector("." + timeSliderLegendId);
18725
+ var pixelsToLeft = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['left'];
18494
18726
 
18495
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
18727
+ var _t = __read(React__namespace.useState(moment__default["default"].utc(0)), 2),
18728
+ tooltipTime = _t[0],
18729
+ setTooltipTime = _t[1];
18496
18730
 
18497
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
18498
- centerTime, canvasWidth, secondsPerPx);
18499
- setLocalAnimationEndTime(mouseTimeUnix);
18500
- setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18501
- return;
18502
- }
18503
-
18504
- if (animationAreaDragging) {
18505
- if (animationDiff.current === undefined) {
18506
- var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
18507
- var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
18508
- var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
18509
- animationDiff.current = {
18510
- diffStartToRight: diffRightAnimationToStartDraggingPosition,
18511
- diffStartToLeft: diffLeftAnimationToStartDraggingPosition
18512
- };
18513
- return;
18514
- }
18731
+ var _u = useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition),
18732
+ handleAnimationDragging = _u.handleAnimationDragging,
18733
+ localAnimationEndTime = _u.localAnimationEndTime,
18734
+ localAnimationStartTime = _u.localAnimationStartTime;
18515
18735
 
18516
- pixelsMovedSinceStartDragging.current += x;
18517
- var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
18518
- var _b = animationDiff.current,
18519
- diffStartToRight = _b.diffStartToRight,
18520
- diffStartToLeft = _b.diffStartToLeft;
18521
- var startTime = currentPositionTimestamp - diffStartToLeft;
18522
- var endTime = currentPositionTimestamp + diffStartToRight;
18523
- setLocalAnimationStartTime(startTime);
18524
- setLocalAnimationEndTime(endTime);
18525
- }
18526
- }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, pixelsToLeft, animationDiff]);
18527
18736
  var setSelectedTime = React.useCallback(function (x) {
18528
18737
  var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
18529
18738
  setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
@@ -18534,12 +18743,11 @@
18534
18743
  if (event.movementX === 0) return;
18535
18744
 
18536
18745
  if (mouseDownInLegend) {
18537
- setCenterTimeDragging(true);
18538
18746
  var dragDistanceTime = event.movementX * secondsPerPx;
18539
18747
  var newCenterTime = centerTime - dragDistanceTime;
18540
18748
  onSetCenterTime && onSetCenterTime(newCenterTime);
18541
18749
  } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
18542
- onMouseTouchMoveActions(event.movementX);
18750
+ handleAnimationDragging(event.movementX);
18543
18751
  } else if (selectedTimeDragging) {
18544
18752
  setSelectedTime(event.movementX);
18545
18753
  }
@@ -18549,9 +18757,9 @@
18549
18757
  return function () {
18550
18758
  document.removeEventListener('mousemove', handleMouseMove);
18551
18759
  };
18552
- }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, onMouseTouchMoveActions, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
18760
+ }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, handleAnimationDragging, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
18553
18761
  var theme = material.useTheme();
18554
- var startDraggingPosition = React__namespace.useRef(0);
18762
+ var isClickOrDrag = React__namespace.useRef();
18555
18763
 
18556
18764
  var onMouseDown = function onMouseDown(x, y, width) {
18557
18765
  isClickOrDrag.current = 'click';
@@ -18571,7 +18779,7 @@
18571
18779
  return;
18572
18780
  }
18573
18781
 
18574
- if (animationStartTime && animationEndTime && onSetAnimationStartTime && onSetAnimationEndTime) {
18782
+ if (animationStartTime && animationEndTime) {
18575
18783
  dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
18576
18784
 
18577
18785
  if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
@@ -18601,22 +18809,7 @@
18601
18809
  setMouseDownInLegend(true);
18602
18810
  };
18603
18811
 
18604
- React__namespace.useEffect(function () {
18605
- var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
18606
-
18607
- if (stoppedDragging) {
18608
- if (localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
18609
- onSetAnimationStartTime(moment__default["default"].utc(localAnimationStartTime * 1000).format(dateFormat));
18610
- }
18611
-
18612
- if (localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
18613
- onSetAnimationEndTime(moment__default["default"].utc(localAnimationEndTime * 1000).format(dateFormat));
18614
- }
18615
- } // eslint-disable-next-line react-hooks/exhaustive-deps
18616
-
18617
- }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
18618
-
18619
- var onMouseUpTouchEnd = function onMouseUpTouchEnd(x) {
18812
+ var onMouseUp = function onMouseUp(x) {
18620
18813
  if (isClickOrDrag.current === 'click') {
18621
18814
  // we need to set the unfiltered time, so the timebox will update accordingly
18622
18815
  setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
@@ -18658,8 +18851,8 @@
18658
18851
  }
18659
18852
  };
18660
18853
 
18661
- var dragTooltipPosition = React__namespace.useRef();
18662
18854
  var popperRef = React__namespace.useRef(null);
18855
+ var pixelsToTop = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['top'];
18663
18856
 
18664
18857
  var setTooltipPosition = function setTooltipPosition() {
18665
18858
  var tooltipX = dragTooltipPosition.current;
@@ -18678,7 +18871,7 @@
18678
18871
  }
18679
18872
  }, /*#__PURE__*/React__namespace.createElement(material.Box, {
18680
18873
  "data-testid": "timeSliderLegend",
18681
- className: "timeSliderLegend_" + mapId,
18874
+ className: timeSliderLegendId,
18682
18875
  sx: {
18683
18876
  height: TIME_SLIDER_LEGEND_HEIGHT + "px",
18684
18877
  borderRadius: '4.5px',
@@ -18695,7 +18888,7 @@
18695
18888
  onSetCenterTime && onSetCenterTime(newCenterTime);
18696
18889
  },
18697
18890
  onMouseDown: onMouseDown,
18698
- onMouseUp: onMouseUpTouchEnd,
18891
+ onMouseUp: onMouseUp,
18699
18892
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
18700
18893
  setCanvasWidth(width);
18701
18894
  drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
@@ -18703,12 +18896,6 @@
18703
18896
  })));
18704
18897
  };
18705
18898
 
18706
- function convertStringTimeToUnix(time) {
18707
- return time ? moment__default["default"].utc(time).unix() : undefined;
18708
- }
18709
-
18710
- var TIME_SLIDER_LEGEND_HEIGHT = 24;
18711
-
18712
18899
  /* *
18713
18900
  * Licensed under the Apache License, Version 2.0 (the "License");
18714
18901
  * you may not use this file except in compliance with the License.
@@ -19197,26 +19384,46 @@
19197
19384
  var isTimestepAuto$1 = reactRedux.useSelector(function (store) {
19198
19385
  return isTimestepAuto(store, mapId);
19199
19386
  });
19200
- var onToggleTimestepAuto = React__namespace.useCallback(function () {
19387
+ var activeLayerId = reactRedux.useSelector(function (store) {
19388
+ return getActiveLayerId(store, mapId);
19389
+ });
19390
+ var activeLayerTimeDimension = reactRedux.useSelector(function (store) {
19391
+ return getLayerTimeDimension(store, activeLayerId);
19392
+ });
19393
+
19394
+ var onToggleTimestepAuto = function onToggleTimestepAuto() {
19395
+ var newTimestepAuto = !isTimestepAuto$1;
19396
+
19397
+ if (newTimestepAuto) {
19398
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
19399
+
19400
+ if (timeStepFromLayer) {
19401
+ dispatch(mapActions$1.setTimeStep({
19402
+ mapId: mapId,
19403
+ timeStep: timeStepFromLayer
19404
+ }));
19405
+ }
19406
+ }
19407
+
19201
19408
  dispatch(mapActions$1.toggleTimestepAuto({
19202
19409
  mapId: mapId,
19203
- timestepAuto: !isTimestepAuto$1,
19204
- origin: MapActionOrigin.map
19410
+ timestepAuto: newTimestepAuto
19205
19411
  }));
19206
- }, [dispatch, isTimestepAuto$1, mapId]);
19207
- var onSetTimeStep = React__namespace.useCallback(function (timeStep, origin) {
19208
- dispatch(mapActions$1.setTimeStep(__assign({
19412
+ };
19413
+
19414
+ var onSetTimeStep = function onSetTimeStep(timeStep) {
19415
+ dispatch(mapActions$1.setTimeStep({
19209
19416
  mapId: mapId,
19210
19417
  timeStep: timeStep
19211
- }, origin && {
19212
- origin: origin
19213
- })));
19214
- }, [dispatch, mapId]);
19418
+ }));
19419
+ };
19420
+
19215
19421
  return /*#__PURE__*/React__namespace.createElement(TimeStepButton, {
19216
19422
  timeStep: timeStep,
19217
19423
  onChangeTimeStep: onSetTimeStep,
19218
19424
  disabled: isAnimating$1,
19219
- onToggleTimestepAuto: onToggleTimestepAuto
19425
+ onToggleTimestepAuto: onToggleTimestepAuto,
19426
+ isTimestepAuto: Boolean(isTimestepAuto$1)
19220
19427
  });
19221
19428
  };
19222
19429
 
@@ -19397,7 +19604,8 @@
19397
19604
  return /*#__PURE__*/React__namespace.createElement(AnimationLengthButton, {
19398
19605
  disabled: isAnimating$1,
19399
19606
  animationLength: currentLength || Number(AnimationLength.Hours24),
19400
- onChangeAnimationLength: handlechangeAnimationLength
19607
+ onChangeAnimationLength: handlechangeAnimationLength,
19608
+ animationLengthInMinutes: currentDiffInMinutes
19401
19609
  });
19402
19610
  };
19403
19611
 
@@ -19429,27 +19637,6 @@
19429
19637
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_a) {
19430
19638
  var sourceId = _a.sourceId,
19431
19639
  mapId = _a.mapId;
19432
- var dispatch = reactRedux.useDispatch();
19433
- var isTimestepAuto$1 = reactRedux.useSelector(function (store) {
19434
- return isTimestepAuto(store, mapId);
19435
- });
19436
- var timeStep = reactRedux.useSelector(function (store) {
19437
- return getMapTimeStep(store, mapId);
19438
- });
19439
- var activeLayerId = reactRedux.useSelector(function (store) {
19440
- return getActiveLayerId(store, mapId);
19441
- });
19442
- var activeLayerTimeDimension = reactRedux.useSelector(function (store) {
19443
- return getLayerTimeDimension(store, activeLayerId);
19444
- });
19445
- var onSetTimeStep = React__namespace.useCallback(function (timeStep, origin) {
19446
- dispatch(mapActions$1.setTimeStep(__assign({
19447
- mapId: mapId,
19448
- timeStep: timeStep
19449
- }, origin && {
19450
- origin: origin
19451
- })));
19452
- }, [dispatch, mapId]);
19453
19640
  return /*#__PURE__*/React__namespace.createElement(OptionsMenuButton, {
19454
19641
  nowBtn: /*#__PURE__*/React__namespace.createElement(NowButtonConnect, {
19455
19642
  mapId: mapId,
@@ -19469,11 +19656,7 @@
19469
19656
  }),
19470
19657
  timeScaleBtn: /*#__PURE__*/React__namespace.createElement(TimeScaleButtonConnect, {
19471
19658
  mapId: mapId
19472
- }),
19473
- timeStep: timeStep,
19474
- isTimestepAuto: isTimestepAuto$1,
19475
- onChangeTimeStep: onSetTimeStep,
19476
- timeDimension: activeLayerTimeDimension
19659
+ })
19477
19660
  });
19478
19661
  };
19479
19662
 
@@ -20630,6 +20813,37 @@
20630
20813
 
20631
20814
  return null;
20632
20815
  };
20816
+ var generatedDrawFunctionIds = 0;
20817
+
20818
+ var generateDrawFunctionId = function generateDrawFunctionId() {
20819
+ generatedDrawFunctionIds += 1;
20820
+ return "drawFunctionId_" + generatedDrawFunctionIds;
20821
+ };
20822
+ /**
20823
+ * DrawFunction store for re-use of drawFunctions
20824
+ */
20825
+
20826
+
20827
+ var drawFunctionStore = [];
20828
+ var getDrawFunctionFromStore = function getDrawFunctionFromStore(id) {
20829
+ var drawFunction = drawFunctionStore.find(function (drawFunction) {
20830
+ return drawFunction.id === id;
20831
+ });
20832
+ return drawFunction === null || drawFunction === void 0 ? void 0 : drawFunction.drawMethod;
20833
+ };
20834
+ var registerDrawFunction = function registerDrawFunction(drawFunction) {
20835
+ if (drawFunction === void 0) {
20836
+ drawFunction = function drawFunction() {};
20837
+ }
20838
+
20839
+ var id = generateDrawFunctionId();
20840
+ var newFunction = {
20841
+ id: id,
20842
+ drawMethod: drawFunction
20843
+ };
20844
+ drawFunctionStore.push(newFunction);
20845
+ return id;
20846
+ };
20633
20847
 
20634
20848
  /* *
20635
20849
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22396,22 +22610,25 @@
22396
22610
  }
22397
22611
 
22398
22612
  var drawStyledMarker = featureProperties ? featureProperties.stroke || featureProperties['stroke-width'] || featureProperties.fill : null;
22399
- var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunction;
22400
-
22401
- if (featureProperties.drawFunction) {
22402
- var isHovered = this.featureEvent && this.featureEvent.feature === feature;
22403
- featureProperties.drawFunction({
22404
- context: ctx,
22405
- featureIndex: featureIndex,
22406
- coord: _coord,
22407
- selected: selected,
22408
- middle: middle,
22409
- isInEditMode: isInEditMode,
22410
- feature: feature,
22411
- mouseX: this.mouseX,
22412
- mouseY: this.mouseY,
22413
- isHovered: isHovered
22414
- });
22613
+ var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunctionId;
22614
+
22615
+ if (featureProperties.drawFunctionId) {
22616
+ var drawFunction = getDrawFunctionFromStore(featureProperties.drawFunctionId);
22617
+
22618
+ if (drawFunction) {
22619
+ var isHovered = this.featureEvent && this.featureEvent.feature === feature;
22620
+ drawFunction({
22621
+ context: ctx,
22622
+ featureIndex: featureIndex,
22623
+ coord: _coord,
22624
+ selected: selected,
22625
+ isInEditMode: isInEditMode,
22626
+ feature: feature,
22627
+ mouseX: this.mouseX,
22628
+ mouseY: this.mouseY,
22629
+ isHovered: isHovered
22630
+ });
22631
+ }
22415
22632
  } else if (drawStyledMarker || drawMarkerByDefault) {
22416
22633
  this.drawMarker(ctx, _coord, selected, middle, isInEditMode, featureProperties);
22417
22634
  }
@@ -22991,9 +23208,8 @@
22991
23208
 
22992
23209
  ReactMapView.prototype.componentDidMount = function () {
22993
23210
  var _a = this.props,
22994
- onMount = _a.onMount,
23211
+ onWMJSMount = _a.onWMJSMount,
22995
23212
  mapId = _a.mapId,
22996
- onRegisterAdaguc = _a.onRegisterAdaguc,
22997
23213
  shouldAutoFetch = _a.shouldAutoFetch;
22998
23214
  this.checkAdaguc();
22999
23215
  this.checkNewProps(null, this.props);
@@ -23001,13 +23217,9 @@
23001
23217
 
23002
23218
  if (this.adaguc.initialized === false && this.adaguc.webMapJS) {
23003
23219
  this.adaguc.initialized = true;
23004
-
23005
- if (onRegisterAdaguc) {
23006
- onRegisterAdaguc(this.adaguc.webMapJS);
23007
- }
23008
23220
  }
23009
23221
 
23010
- onMount(mapId, this.adaguc.webMapJS);
23222
+ onWMJSMount(mapId);
23011
23223
 
23012
23224
  if (shouldAutoFetch) {
23013
23225
  this.onStartRefetchTimer();
@@ -23015,11 +23227,7 @@
23015
23227
  };
23016
23228
 
23017
23229
  ReactMapView.prototype.componentWillUnmount = function () {
23018
- var _a = this.props,
23019
- onUnMount = _a.onUnMount,
23020
- mapId = _a.mapId;
23021
23230
  window.removeEventListener('resize', this.handleWindowResize);
23022
- onUnMount(mapId, this.adaguc.webMapJS);
23023
23231
  this.adaguc.webMapJS.getListener().suspendEvents();
23024
23232
 
23025
23233
  if (typeof this.adaguc.webMapJS.stopAnimating === 'function') {
@@ -23644,8 +23852,7 @@
23644
23852
  shouldAutoFetch: true,
23645
23853
  displayMapPin: false,
23646
23854
  disableMapPin: false,
23647
- onMount: function onMount() {},
23648
- onUnMount: function onUnMount() {},
23855
+ onWMJSMount: function onWMJSMount() {},
23649
23856
  onMapChangeDimension: function onMapChangeDimension() {
23650
23857
  /* nothing */
23651
23858
  },
@@ -23740,8 +23947,8 @@
23740
23947
  // rest props
23741
23948
  props = __rest(_a, ["children", "controls", "displayTimeInMap"]);
23742
23949
 
23743
- var dimensions = props.dimensions;
23744
- var adagucRef = React__namespace.useRef(null);
23950
+ var dimensions = props.dimensions,
23951
+ mapId = props.mapId;
23745
23952
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
23746
23953
  sx: {
23747
23954
  display: 'grid',
@@ -23757,13 +23964,16 @@
23757
23964
  }
23758
23965
  }, /*#__PURE__*/React__namespace.createElement(ZoomControls, {
23759
23966
  onZoomIn: function onZoomIn() {
23760
- return adagucRef.current.zoomIn(undefined);
23967
+ var wmjsMap = getWMJSMapById(mapId);
23968
+ wmjsMap.zoomIn(undefined);
23761
23969
  },
23762
23970
  onZoomOut: function onZoomOut() {
23763
- return adagucRef.current.zoomOut();
23971
+ var wmjsMap = getWMJSMapById(mapId);
23972
+ wmjsMap.zoomOut();
23764
23973
  },
23765
23974
  onZoomReset: function onZoomReset() {
23766
- return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
23975
+ var wmjsMap = getWMJSMapById(mapId);
23976
+ wmjsMap.zoomToLayer(wmjsMap.getActiveLayer());
23767
23977
  }
23768
23978
  })), /*#__PURE__*/React__namespace.createElement(material.Box, {
23769
23979
  sx: {
@@ -23771,9 +23981,6 @@
23771
23981
  gridRowStart: 1
23772
23982
  }
23773
23983
  }, /*#__PURE__*/React__namespace.createElement(ReactMapView, __assign({}, props, {
23774
- onRegisterAdaguc: function onRegisterAdaguc(adaguc) {
23775
- adagucRef.current = adaguc;
23776
- },
23777
23984
  showLegend: false,
23778
23985
  displayTimeInMap: false
23779
23986
  }), children)), displayTimeInMap && dimensions && /*#__PURE__*/React__namespace.createElement(MapTime, {
@@ -24152,7 +24359,7 @@
24152
24359
  dispatch(mapActions$1.setMapPinLocation(payload));
24153
24360
  }, [dispatch]);
24154
24361
  var setSelectedFeature = React__namespace.useCallback(function (payload) {
24155
- dispatch(mapActions$1.setSelectedFeature(payload));
24362
+ dispatch(layerActions.setSelectedFeature(payload));
24156
24363
  }, [dispatch]);
24157
24364
  var activeWindowId = reactRedux.useSelector(getActiveWindowId);
24158
24365
 
@@ -24162,29 +24369,29 @@
24162
24369
 
24163
24370
  useKeyboardZoomAndPan(isActiveWindowId(), mapId);
24164
24371
  useTouchZoomPan(isActiveWindowId(), mapId);
24165
- return /*#__PURE__*/React__namespace.createElement("div", {
24166
- style: {
24167
- height: '100%'
24168
- }
24169
- }, /*#__PURE__*/React__namespace.createElement(MapView, __assign({}, props, {
24170
- mapId: mapId,
24171
- onMount: function onMount() {
24172
- registerMap({
24173
- mapId: mapId
24174
- });
24175
- syncGroupAddSource({
24176
- id: mapId,
24177
- type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
24178
- });
24179
- },
24180
- onUnMount: function onUnMount() {
24372
+ React__namespace.useEffect(function () {
24373
+ registerMap({
24374
+ mapId: mapId
24375
+ });
24376
+ syncGroupAddSource({
24377
+ id: mapId,
24378
+ type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
24379
+ });
24380
+ return function () {
24181
24381
  unregisterMap({
24182
24382
  mapId: mapId
24183
24383
  });
24184
24384
  syncGroupRemoveSource({
24185
24385
  id: mapId
24186
24386
  });
24187
- },
24387
+ };
24388
+ }, [mapId, registerMap, syncGroupAddSource, syncGroupRemoveSource, unregisterMap]);
24389
+ return /*#__PURE__*/React__namespace.createElement("div", {
24390
+ style: {
24391
+ height: '100%'
24392
+ }
24393
+ }, /*#__PURE__*/React__namespace.createElement(MapView, __assign({}, props, {
24394
+ mapId: mapId,
24188
24395
  srs: srs,
24189
24396
  bbox: bbox,
24190
24397
  mapPinLocation: displayMapPin ? mapPinLocation : undefined,
@@ -24239,7 +24446,7 @@
24239
24446
  },
24240
24447
  onClickFeature: layer.geojson ? function (event) {
24241
24448
  setSelectedFeature({
24242
- mapId: mapId,
24449
+ layerId: layer.id,
24243
24450
  selectedFeatureIndex: event === null || event === void 0 ? void 0 : event.featureIndex
24244
24451
  });
24245
24452
  } : undefined
@@ -24929,7 +25136,7 @@
24929
25136
  /* Build a layerlist array with a set of arguments per layer to do the query for */
24930
25137
 
24931
25138
 
24932
- var layerToUpdateList = getLayersToUpdate(layers, mapId);
25139
+ var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
24933
25140
  /*
24934
25141
  Build a string based on the GFI urls. If this changes for whatever reason we need to update.
24935
25142
  These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
@@ -24970,7 +25177,7 @@
24970
25177
 
24971
25178
  case 2:
24972
25179
  error_1 = _a.sent();
24973
- errorMessage = error_1.message();
25180
+ errorMessage = error_1.message;
24974
25181
  updateLayerResult({
24975
25182
  layerId: layerId,
24976
25183
  data: errorMessage,
@@ -25118,9 +25325,6 @@
25118
25325
  mapId = _a.mapId;
25119
25326
  var dispatch = reactRedux.useDispatch();
25120
25327
  var getFeatureInfoType = "getfeatureinfo-" + mapId;
25121
- var isMapPinVisible = reactRedux.useSelector(function (store) {
25122
- return getDisplayMapPin(store, mapId);
25123
- });
25124
25328
  var mapPinLocation = reactRedux.useSelector(function (store) {
25125
25329
  return getPinLocation(store, mapId);
25126
25330
  });
@@ -25130,6 +25334,14 @@
25130
25334
  displayMapPin: displayMapPin
25131
25335
  }));
25132
25336
  }, [dispatch, mapId]);
25337
+
25338
+ var enableMapPin = function enableMapPin() {
25339
+ dispatch(mapActions$1.setDisableMapPin({
25340
+ mapId: mapId,
25341
+ disableMapPin: false
25342
+ }));
25343
+ };
25344
+
25133
25345
  var mapLayers = reactRedux.useSelector(function (store) {
25134
25346
  return getMapLayers(store, mapId);
25135
25347
  });
@@ -25143,7 +25355,14 @@
25143
25355
 
25144
25356
  React__namespace.useEffect(function () {
25145
25357
  toggleMapPinIsVisible(isDialogOpen);
25146
- }, [isDialogOpen, toggleMapPinIsVisible, isMapPinVisible]);
25358
+
25359
+ if (isDialogOpen) {
25360
+ enableMapPin();
25361
+ }
25362
+ /* Do not respond on changes of isMapPinVisible, to allow other components to open/close the mappin. */
25363
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25364
+
25365
+ }, [isDialogOpen, toggleMapPinIsVisible]);
25147
25366
  return /*#__PURE__*/React__namespace.createElement(GetFeatureInfoDialog, {
25148
25367
  layers: mapLayers,
25149
25368
  isOpen: isDialogOpen,
@@ -26511,6 +26730,7 @@
26511
26730
  exports.ConfigurableMapConnect = ConfigurableMapConnect;
26512
26731
  exports.CoreThemeProvider = CoreThemeProvider;
26513
26732
  exports.CoreThemeStoreProvider = CoreThemeStoreProvider;
26733
+ exports.DockedLayerManagerConnect = DockedLayerManagerConnect;
26514
26734
  exports.HarmonieTempAndPrecipPreset = HarmonieTempAndPrecipPreset;
26515
26735
  exports.LayerManagerConnect = LayerManagerConnect;
26516
26736
  exports.LayerManagerMapButtonConnect = LayerManagerMapButtonConnect;
@@ -26546,6 +26766,7 @@
26546
26766
  exports.generateLayerId = generateLayerId;
26547
26767
  exports.generateMapId = generateMapId;
26548
26768
  exports.generateTimesliderId = generateTimesliderId;
26769
+ exports.getDrawFunctionFromStore = getDrawFunctionFromStore;
26549
26770
  exports.getFirstTimeStepForLayerId = getFirstTimeStepForLayerId;
26550
26771
  exports.getInitialAppPresets = getInitialAppPresets;
26551
26772
  exports.getLastTimeStepForLayerId = getLastTimeStepForLayerId;
@@ -26557,6 +26778,8 @@
26557
26778
  exports.getWMLayerById = getWMLayerById;
26558
26779
  exports.layerActions = layerActions;
26559
26780
  exports.layerReducer = reducer$6;
26781
+ exports.layerSelectors = selectors$2;
26782
+ exports.layerTypes = types$3;
26560
26783
  exports.mapActions = mapActions;
26561
26784
  exports.mapModuleConfig = moduleConfig;
26562
26785
  exports.mapSelectors = selectors;
@@ -26566,6 +26789,7 @@
26566
26789
  exports.parseLayer = parseLayer;
26567
26790
  exports.publicLayers = publicLayers;
26568
26791
  exports.publicServices = publicServices;
26792
+ exports.registerDrawFunction = registerDrawFunction;
26569
26793
  exports.registerWMJSMap = registerWMJSMap;
26570
26794
  exports.registerWMLayer = registerWMLayer;
26571
26795
  exports.snackbarActions = snackbarActions;
@@ -26574,6 +26798,7 @@
26574
26798
  exports.synchronizationGroupModuleConfig = synchronizationGroupConfig;
26575
26799
  exports.synchronizationGroupsConfig = synchronizationGroupConfig;
26576
26800
  exports.testLayers = testLayers;
26801
+ exports.timeSliderUtils = TimeSliderUtils;
26577
26802
  exports.uiActions = uiActions;
26578
26803
  exports.uiModuleConfig = uiModuleConfig;
26579
26804
  exports.uiSelectors = selectors$1;