@opengeoweb/store 12.5.0 → 12.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore } from '@reduxjs/toolkit';
2
2
  import { isEqual, isEmpty, compact } from 'lodash';
3
3
  import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
4
- import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, getWMJSMapById, webmapTestSettings, WMLayer, getWMSRequests, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers, getWMLayerById, WMInvalidDateValues } from '@opengeoweb/webmap';
4
+ import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, getWMJSMapById, webmapTestSettings, WMLayer, getWMSRequests, getWMLayerById, WMInvalidDateValues, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
5
5
  import { defaultSecondsPerPx, defaultAnimationDelayAtStart, defaultTimeStep, defaultTimeSpan, roundWithTimeStep, getSpeedDelay } from '@opengeoweb/timeslider';
6
6
  import { produce } from 'immer';
7
- import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection, isOpenLayersEnabled } from '@opengeoweb/webmap-react';
7
+ import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, isOpenLayersEnabled, defaultLayers, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
8
8
  export { defaultLayers } from '@opengeoweb/webmap-react';
9
9
  import { useSelector, useDispatch } from 'react-redux';
10
10
  import { useCallback, useEffect } from 'react';
@@ -2561,12 +2561,12 @@ var slice$4 = createSlice({
2561
2561
  if (!map) {
2562
2562
  return;
2563
2563
  }
2564
- if (autoUpdateLayerId || autoTimeStepLayerId) {
2565
- map.autoUpdateLayerId = autoUpdateLayerId;
2564
+ if (autoTimeStepLayerId || autoUpdateLayerId) {
2566
2565
  map.autoTimeStepLayerId = autoTimeStepLayerId;
2566
+ map.autoUpdateLayerId = autoUpdateLayerId;
2567
2567
  } else if (layerId) {
2568
- map.autoUpdateLayerId = layerId;
2569
2568
  map.autoTimeStepLayerId = layerId;
2569
+ map.autoUpdateLayerId = layerId;
2570
2570
  } else {
2571
2571
  map.autoTimeStepLayerId = undefined;
2572
2572
  map.autoUpdateLayerId = undefined;
@@ -5579,7 +5579,7 @@ var getLegendId = createSelector(getMapById, function (store) {
5579
5579
  * @param {string} mapId mapId: string - Id of the map
5580
5580
  * @returns {MapPreset} returnType: MapPreset
5581
5581
  */
5582
- var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, getAnimationStartTime, getAnimationEndTime, getMapTimeSliderSpan, isTimestepAuto, isTimeSpanAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoUpdateLayerId, autoTimeStepLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, animationStartTime, animationEndTime, timeSliderSpan, isTimestepAuto, isTimeSpanAuto, legendId, uiStore) {
5582
+ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, getAnimationStartTime, getAnimationEndTime, getMapTimeSliderSpan, isTimestepAuto, isTimeSpanAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, animationStartTime, animationEndTime, timeSliderSpan, isTimestepAuto, isTimeSpanAuto, legendId, uiStore) {
5583
5583
  var _uiStore$dialogs$lege;
5584
5584
  var allLayers = [].concat(_toConsumableArray(baseLayers), _toConsumableArray(overLayers), _toConsumableArray(mapLayers)).map(function (_ref3) {
5585
5585
  _ref3.mapId;
@@ -6696,6 +6696,179 @@ var prefetchAnimationTargetsForMetronome = function prefetchAnimationTargetsForM
6696
6696
  return timerShouldStepForward;
6697
6697
  };
6698
6698
 
6699
+ /* A map with all the timerIds and their current step */
6700
+ var stepMap = new Map();
6701
+ /* A map with a list of timers and their dwell */
6702
+ var timerDwellMap = new Map();
6703
+ /**
6704
+ * Returns the next step for given timerId.
6705
+ * @param timerId The timer id
6706
+ * @param numberOfStepsInAnimation Animation length in steps
6707
+ * @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
6708
+ * @returns
6709
+ */
6710
+ var getNextStep = function getNextStep(timerId, numberOfStepsInAnimation) {
6711
+ var numStepsToGoForward = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
6712
+ var currentStep = getCurrentStep(timerId);
6713
+ var nextStep = currentStep + numStepsToGoForward;
6714
+ var nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
6715
+ return nextStepClipped;
6716
+ };
6717
+ /**
6718
+ * Handles dwell at the end of the animation loop sequence. The number of steps to wait till proceed can be set by the dwell parameter.
6719
+ * @param timerId The timer id
6720
+ * @param numberOfStepsInAnimation Number of steps in the animation
6721
+ * @param dwell The number of steps to wait at the end of the animation sequence before to continue
6722
+ * @returns
6723
+ */
6724
+ var handleTimerDwell = function handleTimerDwell(timerId, numberOfStepsInAnimation) {
6725
+ var dwell = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
6726
+ if (dwell > 0) {
6727
+ var currentStep = getCurrentStep(timerId);
6728
+ // Reset the dwell if we are not at the last animation step
6729
+ if (currentStep < numberOfStepsInAnimation - 1) {
6730
+ timerDwellMap.set(timerId, dwell);
6731
+ return false;
6732
+ }
6733
+ // We are at the last animation step, check the dwell
6734
+ var timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
6735
+ if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
6736
+ timerDwellMap.set(timerId, timerDwell - 1);
6737
+ return true;
6738
+ }
6739
+ }
6740
+ return false;
6741
+ };
6742
+ /**
6743
+ * Set step for the timerId
6744
+ * @param timerId
6745
+ * @param timerStep
6746
+ */
6747
+ var setStep = function setStep(timerId, timerStep) {
6748
+ stepMap.set(timerId, timerStep);
6749
+ };
6750
+ /**
6751
+ * Gets the current step for the timer
6752
+ * @param timerId
6753
+ * @returns
6754
+ */
6755
+ var getCurrentStep = function getCurrentStep(timerId) {
6756
+ return stepMap.get(timerId) || 0;
6757
+ };
6758
+ /**
6759
+ * Checks if the next step is available for all provided layers
6760
+ * @param reduxLayers
6761
+ * @param nextTimeString
6762
+ * @returns
6763
+ */
6764
+ var isNextStepAvailable = function isNextStepAvailable(reduxLayers, nextTimeString) {
6765
+ // Get all wmLayers for the found id's
6766
+ var wmLayers = reduxLayers.map(function (reduxLayer) {
6767
+ return reduxLayer.id && getWMLayerById(reduxLayer.id);
6768
+ }).filter(function (l) {
6769
+ return !!l;
6770
+ });
6771
+ // Returns a layer which could have an image for the requested time, but which isn't loaded yet.
6772
+ var isThereSomethingNotAvailable = wmLayers.map(function (l) {
6773
+ var _l$getDimension;
6774
+ if (!l || !l.olSource) {
6775
+ // No OpenLayers source, do nothing, so do not flag that something is not available
6776
+ return {
6777
+ status: true
6778
+ };
6779
+ }
6780
+ // Check if there is a timevalue available
6781
+ var closestValue = (_l$getDimension = l.getDimension('time')) === null || _l$getDimension === void 0 ? void 0 : _l$getDimension.getClosestValue(nextTimeString);
6782
+ if (!closestValue || WMInvalidDateValues.has(closestValue)) {
6783
+ // No value available, so do not flag that something is not available
6784
+ return {
6785
+ status: true
6786
+ };
6787
+ }
6788
+ var olSource = l.olSource;
6789
+ var hasImageAvailableForRequestedTimeStep = olSource.hasImageForTimeValue(closestValue);
6790
+ // If there is no image available for requested timestep, return true and flag that this thing is not ready yet.
6791
+ if (hasImageAvailableForRequestedTimeStep) {
6792
+ return {
6793
+ status: true
6794
+ };
6795
+ }
6796
+ olSource.loadImageForTimeValue(closestValue);
6797
+ return {
6798
+ status: false
6799
+ };
6800
+ });
6801
+ var nextStepIsAvailable = isThereSomethingNotAvailable.filter(function (d) {
6802
+ return d.status === true;
6803
+ }).length === wmLayers.length;
6804
+ return nextStepIsAvailable;
6805
+ };
6806
+ /**
6807
+ * This handler is triggered by the metronome. An array of timerIds is given as argument.
6808
+ * It will update the animation loop of multiple maps and sliders
6809
+ * It will prefetch images for maps
6810
+ * @param timerIds string[] array of timerIds
6811
+ * @param listenerApi ListenerEffectAPI<CoreAppStore, Dispatch, unknown> listenerApi as received from listener
6812
+ */
6813
+ var olMetronomeHandler = function olMetronomeHandler(timerIds, listenerApi) {
6814
+ var targetsWithUpdateValue = [];
6815
+ var _iterator = _createForOfIteratorHelper(timerIds),
6816
+ _step;
6817
+ try {
6818
+ var _loop = function _loop() {
6819
+ var timerId = _step.value;
6820
+ var animationListValuesNameAndValue = getAnimationList(listenerApi.getState(), timerId);
6821
+ var animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
6822
+ return nameAndValue.value;
6823
+ });
6824
+ var targets = getTargets(listenerApi.getState(), {
6825
+ sourceId: timerId,
6826
+ origin: timerId
6827
+ }, SYNCGROUPS_TYPE_SETTIME);
6828
+ if (targets.length === 0) {
6829
+ // When there are no targets, default to one
6830
+ targets.push({
6831
+ targetId: timerId,
6832
+ value: ''
6833
+ });
6834
+ }
6835
+ var timerIsInDwell = handleTimerDwell(timerId, animationListValues.length);
6836
+ // Collect all layers for this syncgroups target
6837
+ var reduxLayers = [];
6838
+ targets.forEach(function (target) {
6839
+ reduxLayers.push.apply(reduxLayers, _toConsumableArray(getLayersByMapId(listenerApi.getState(), target.targetId).filter(function (l) {
6840
+ return l.layerType === LayerType.mapLayer;
6841
+ })));
6842
+ });
6843
+ var nextStep = getNextStep(timerId, animationListValues.length, 1);
6844
+ var timerShouldStepForward = isNextStepAvailable(reduxLayers, animationListValues[nextStep]) && !timerIsInDwell;
6845
+ // Determine the next step
6846
+ var timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
6847
+ setStep(timerId, timerStep);
6848
+ var updatedValue = animationListValues[timerStep];
6849
+ targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
6850
+ return _objectSpread2(_objectSpread2({}, target), {}, {
6851
+ value: updatedValue
6852
+ });
6853
+ })));
6854
+ var speedDelay = getMapAnimationDelay(listenerApi.getState(), timerId);
6855
+ var speed = 1000 / (speedDelay || 1);
6856
+ metronome.setSpeed(timerId, speed);
6857
+ };
6858
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6859
+ _loop();
6860
+ }
6861
+ // Update all targets of all sync groups in one action.
6862
+ } catch (err) {
6863
+ _iterator.e(err);
6864
+ } finally {
6865
+ _iterator.f();
6866
+ }
6867
+ if (targetsWithUpdateValue.length > 0) {
6868
+ listenerApi.dispatch(setTimeSync(null, targetsWithUpdateValue, ['metronomelistener']));
6869
+ }
6870
+ };
6871
+
6699
6872
  var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
6700
6873
  var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
6701
6874
  var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
@@ -6914,7 +7087,11 @@ mapListener.startListening({
6914
7087
  return timeNameValue.value === initialTime;
6915
7088
  });
6916
7089
  if (initalTimerStep !== -1) {
6917
- setStep$1(useMapId, initalTimerStep);
7090
+ if (isOpenLayersEnabled()) {
7091
+ setStep(useMapId, initalTimerStep);
7092
+ } else {
7093
+ setStep$1(useMapId, initalTimerStep);
7094
+ }
6918
7095
  }
6919
7096
  }
6920
7097
  }
@@ -6966,7 +7143,7 @@ mapListener.startListening({
6966
7143
  actionCreator: mapActions.setMapPreset,
6967
7144
  effect: function () {
6968
7145
  var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref6, listenerApi) {
6969
- var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, timeSliderSpan, toggleTimeSpanAuto, _filterLayers, mapLayers, baseLayers, overLayers, _newLayerIds$layers$f, _newLayerIds$layers$, _newLayerIds$layers$f2, _newLayerIds$layers$2, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, newAutoUpdateLayerId, newAutoTimeStepLayerId, customLayers, customBaseLayer, customOverLayer, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, checkIsprojectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, endTime, startTime, centerTimeInSeconds, animationEnd, _startTime, duration, _animationEnd, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, _animationStart;
7146
+ var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, timeSliderSpan, toggleTimeSpanAuto, _filterLayers, mapLayers, baseLayers, overLayers, _newLayerIds$layers$f, _newLayerIds$layers$f2, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, newAutoTimeStepLayerId, newAutoUpdateLayerId, customLayers, customBaseLayer, customOverLayer, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, checkIsprojectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, endTime, startTime, centerTimeInSeconds, animationEnd, _startTime, duration, _animationEnd, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, _animationStart;
6970
7147
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6971
7148
  while (1) switch (_context2.prev = _context2.next) {
6972
7149
  case 0:
@@ -6993,22 +7170,21 @@ mapListener.startListening({
6993
7170
  layers: mapLayers,
6994
7171
  autoTimeStepLayerId: autoTimeStepLayerIdNew,
6995
7172
  autoUpdateLayerId: autoUpdateLayerIdNew
6996
- }); // set layers
7173
+ });
6997
7174
  listenerApi.dispatch(layerActions.setLayers({
6998
7175
  mapId: mapId,
6999
7176
  layers: newLayerIds.layers
7000
7177
  }));
7001
- // make sure layer with new id exist and if not, default to first layer
7002
- newAutoUpdateLayerId = ((_newLayerIds$layers$f = newLayerIds.layers.find(function (layer) {
7003
- return layer.id === newLayerIds.autoUpdateLayerId;
7004
- })) === null || _newLayerIds$layers$f === void 0 ? void 0 : _newLayerIds$layers$f.id) || ((_newLayerIds$layers$ = newLayerIds.layers[0]) === null || _newLayerIds$layers$ === void 0 ? void 0 : _newLayerIds$layers$.id);
7005
- newAutoTimeStepLayerId = ((_newLayerIds$layers$f2 = newLayerIds.layers.find(function (layer) {
7178
+ newAutoTimeStepLayerId = ((_newLayerIds$layers$f = newLayerIds.layers.find(function (layer) {
7006
7179
  return layer.id === newLayerIds.autoTimeStepLayerId;
7007
- })) === null || _newLayerIds$layers$f2 === void 0 ? void 0 : _newLayerIds$layers$f2.id) || ((_newLayerIds$layers$2 = newLayerIds.layers[0]) === null || _newLayerIds$layers$2 === void 0 ? void 0 : _newLayerIds$layers$2.id);
7180
+ })) === null || _newLayerIds$layers$f === void 0 ? void 0 : _newLayerIds$layers$f.id) || undefined;
7181
+ newAutoUpdateLayerId = ((_newLayerIds$layers$f2 = newLayerIds.layers.find(function (layer) {
7182
+ return layer.id === newLayerIds.autoUpdateLayerId;
7183
+ })) === null || _newLayerIds$layers$f2 === void 0 ? void 0 : _newLayerIds$layers$f2.id) || undefined;
7008
7184
  listenerApi.dispatch(mapActions.setAutoLayerId({
7009
7185
  mapId: mapId,
7010
- autoUpdateLayerId: newAutoUpdateLayerId,
7011
- autoTimeStepLayerId: newAutoTimeStepLayerId
7186
+ autoTimeStepLayerId: newAutoTimeStepLayerId,
7187
+ autoUpdateLayerId: newAutoUpdateLayerId
7012
7188
  }));
7013
7189
  }
7014
7190
  customLayers = getdefaultMapSettingsLayers(listenerApi.getState());
@@ -8211,179 +8387,6 @@ layersListener.startListening({
8211
8387
  }()
8212
8388
  });
8213
8389
 
8214
- /* A map with all the timerIds and their current step */
8215
- var stepMap = new Map();
8216
- /* A map with a list of timers and their dwell */
8217
- var timerDwellMap = new Map();
8218
- /**
8219
- * Returns the next step for given timerId.
8220
- * @param timerId The timer id
8221
- * @param numberOfStepsInAnimation Animation length in steps
8222
- * @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
8223
- * @returns
8224
- */
8225
- var getNextStep = function getNextStep(timerId, numberOfStepsInAnimation) {
8226
- var numStepsToGoForward = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
8227
- var currentStep = getCurrentStep(timerId);
8228
- var nextStep = currentStep + numStepsToGoForward;
8229
- var nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
8230
- return nextStepClipped;
8231
- };
8232
- /**
8233
- * Handles dwell at the end of the animation loop sequence. The number of steps to wait till proceed can be set by the dwell parameter.
8234
- * @param timerId The timer id
8235
- * @param numberOfStepsInAnimation Number of steps in the animation
8236
- * @param dwell The number of steps to wait at the end of the animation sequence before to continue
8237
- * @returns
8238
- */
8239
- var handleTimerDwell = function handleTimerDwell(timerId, numberOfStepsInAnimation) {
8240
- var dwell = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
8241
- if (dwell > 0) {
8242
- var currentStep = getCurrentStep(timerId);
8243
- // Reset the dwell if we are not at the last animation step
8244
- if (currentStep < numberOfStepsInAnimation - 1) {
8245
- timerDwellMap.set(timerId, dwell);
8246
- return false;
8247
- }
8248
- // We are at the last animation step, check the dwell
8249
- var timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
8250
- if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
8251
- timerDwellMap.set(timerId, timerDwell - 1);
8252
- return true;
8253
- }
8254
- }
8255
- return false;
8256
- };
8257
- /**
8258
- * Set step for the timerId
8259
- * @param timerId
8260
- * @param timerStep
8261
- */
8262
- var setStep = function setStep(timerId, timerStep) {
8263
- stepMap.set(timerId, timerStep);
8264
- };
8265
- /**
8266
- * Gets the current step for the timer
8267
- * @param timerId
8268
- * @returns
8269
- */
8270
- var getCurrentStep = function getCurrentStep(timerId) {
8271
- return stepMap.get(timerId) || 0;
8272
- };
8273
- /**
8274
- * Checks if the next step is available for all provided layers
8275
- * @param reduxLayers
8276
- * @param nextTimeString
8277
- * @returns
8278
- */
8279
- var isNextStepAvailable = function isNextStepAvailable(reduxLayers, nextTimeString) {
8280
- // Get all wmLayers for the found id's
8281
- var wmLayers = reduxLayers.map(function (reduxLayer) {
8282
- return reduxLayer.id && getWMLayerById(reduxLayer.id);
8283
- }).filter(function (l) {
8284
- return !!l;
8285
- });
8286
- // Returns a layer which could have an image for the requested time, but which isn't loaded yet.
8287
- var isThereSomethingNotAvailable = wmLayers.map(function (l) {
8288
- var _l$getDimension;
8289
- if (!l || !l.olSource) {
8290
- // No OpenLayers source, do nothing, so do not flag that something is not available
8291
- return {
8292
- status: true
8293
- };
8294
- }
8295
- // Check if there is a timevalue available
8296
- var closestValue = (_l$getDimension = l.getDimension('time')) === null || _l$getDimension === void 0 ? void 0 : _l$getDimension.getClosestValue(nextTimeString);
8297
- if (!closestValue || WMInvalidDateValues.has(closestValue)) {
8298
- // No value available, so do not flag that something is not available
8299
- return {
8300
- status: true
8301
- };
8302
- }
8303
- var olSource = l.olSource;
8304
- var hasImageAvailableForRequestedTimeStep = olSource.hasImageForTimeValue(closestValue);
8305
- // If there is no image available for requested timestep, return true and flag that this thing is not ready yet.
8306
- if (hasImageAvailableForRequestedTimeStep) {
8307
- return {
8308
- status: true
8309
- };
8310
- }
8311
- olSource.loadImageForTimeValue(closestValue);
8312
- return {
8313
- status: false
8314
- };
8315
- });
8316
- var nextStepIsAvailable = isThereSomethingNotAvailable.filter(function (d) {
8317
- return d.status === true;
8318
- }).length === wmLayers.length;
8319
- return nextStepIsAvailable;
8320
- };
8321
- /**
8322
- * This handler is triggered by the metronome. An array of timerIds is given as argument.
8323
- * It will update the animation loop of multiple maps and sliders
8324
- * It will prefetch images for maps
8325
- * @param timerIds string[] array of timerIds
8326
- * @param listenerApi ListenerEffectAPI<CoreAppStore, Dispatch, unknown> listenerApi as received from listener
8327
- */
8328
- var olMetronomeHandler = function olMetronomeHandler(timerIds, listenerApi) {
8329
- var targetsWithUpdateValue = [];
8330
- var _iterator = _createForOfIteratorHelper(timerIds),
8331
- _step;
8332
- try {
8333
- var _loop = function _loop() {
8334
- var timerId = _step.value;
8335
- var animationListValuesNameAndValue = getAnimationList(listenerApi.getState(), timerId);
8336
- var animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
8337
- return nameAndValue.value;
8338
- });
8339
- var targets = getTargets(listenerApi.getState(), {
8340
- sourceId: timerId,
8341
- origin: timerId
8342
- }, SYNCGROUPS_TYPE_SETTIME);
8343
- if (targets.length === 0) {
8344
- // When there are no targets, default to one
8345
- targets.push({
8346
- targetId: timerId,
8347
- value: ''
8348
- });
8349
- }
8350
- var timerIsInDwell = handleTimerDwell(timerId, animationListValues.length);
8351
- // Collect all layers for this syncgroups target
8352
- var reduxLayers = [];
8353
- targets.forEach(function (target) {
8354
- reduxLayers.push.apply(reduxLayers, _toConsumableArray(getLayersByMapId(listenerApi.getState(), target.targetId).filter(function (l) {
8355
- return l.layerType === LayerType.mapLayer;
8356
- })));
8357
- });
8358
- var nextStep = getNextStep(timerId, animationListValues.length, 1);
8359
- var timerShouldStepForward = isNextStepAvailable(reduxLayers, animationListValues[nextStep]) && !timerIsInDwell;
8360
- // Determine the next step
8361
- var timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
8362
- setStep(timerId, timerStep);
8363
- var updatedValue = animationListValues[timerStep];
8364
- targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
8365
- return _objectSpread2(_objectSpread2({}, target), {}, {
8366
- value: updatedValue
8367
- });
8368
- })));
8369
- var speedDelay = getMapAnimationDelay(listenerApi.getState(), timerId);
8370
- var speed = 1000 / (speedDelay || 1);
8371
- metronome.setSpeed(timerId, speed);
8372
- };
8373
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
8374
- _loop();
8375
- }
8376
- // Update all targets of all sync groups in one action.
8377
- } catch (err) {
8378
- _iterator.e(err);
8379
- } finally {
8380
- _iterator.f();
8381
- }
8382
- if (targetsWithUpdateValue.length > 0) {
8383
- listenerApi.dispatch(setTimeSync(null, targetsWithUpdateValue, ['metronomelistener']));
8384
- }
8385
- };
8386
-
8387
8390
  /**
8388
8391
  * This handler is triggered by the metronome. An array of timerIds is given as argument.
8389
8392
  * It will update the animation loop of multiple maps and sliders
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "12.5.0",
3
+ "version": "12.6.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,15 +8,15 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/shared": "12.5.0",
11
+ "@opengeoweb/shared": "12.6.0",
12
12
  "react-redux": "^9.2.0",
13
13
  "@reduxjs/toolkit": "^2.6.1",
14
- "@opengeoweb/webmap-react": "12.5.0",
15
- "@opengeoweb/webmap": "12.5.0",
14
+ "@opengeoweb/webmap-react": "12.6.0",
15
+ "@opengeoweb/webmap": "12.6.0",
16
16
  "immer": "^10.0.3",
17
17
  "lodash": "^4.17.21",
18
- "@opengeoweb/metronome": "12.5.0",
19
- "@opengeoweb/timeslider": "12.5.0",
18
+ "@opengeoweb/metronome": "12.6.0",
19
+ "@opengeoweb/timeslider": "12.6.0",
20
20
  "react-router-dom": "^6.23.1",
21
21
  "ol": "^10.4.0",
22
22
  "@turf/turf": "^7.2.0"
@@ -139,8 +139,8 @@ export interface SetMapAnimationStopPayload {
139
139
  export interface SetAutoLayerIdPayload {
140
140
  mapId: string;
141
141
  layerId?: string;
142
- autoUpdateLayerId?: string;
143
142
  autoTimeStepLayerId?: string;
143
+ autoUpdateLayerId?: string;
144
144
  origin?: LayerActionOrigin | string;
145
145
  }
146
146
  export interface ToggleAutoUpdatePayload {