@opengeoweb/core 4.9.1 → 4.10.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.umd.js CHANGED
@@ -836,46 +836,66 @@
836
836
  TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
837
837
  TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
838
838
  TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
839
+ TimeInMinutes[TimeInMinutes["MINUTE"] = 1] = "MINUTE";
839
840
  })(TimeInMinutes || (TimeInMinutes = {}));
841
+ /**
842
+ *
843
+ * @param minutes
844
+ * @returns the two highest values in the format yr(s) mo(s) d h m
845
+ */
840
846
 
841
- var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
842
- var dateStr = '';
843
- var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
844
-
845
- if (time >= TimeInMinutes.YEAR) {
846
- var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
847
- dateStr += yearsInMintues + "y";
848
- time -= yearsInMintues * TimeInMinutes.YEAR;
849
- }
850
847
 
851
- if (time >= TimeInMinutes.MONTH) {
852
- var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
853
- dateStr += monthsInMinutes + "m";
854
- time -= monthsInMinutes * TimeInMinutes.MONTH;
855
- }
856
-
857
- if (time >= TimeInMinutes.DAY) {
858
- var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
859
- dateStr += daysInMinutes + "d";
860
- time -= daysInMinutes * TimeInMinutes.DAY;
861
- } // we will always print hour/minutes if there are any of them in the XX:XX format
862
-
863
-
864
- if (time > 0) {
865
- if (dateStr !== '') dateStr += ' ';
866
- dateStr += Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
867
- minimumIntegerDigits: 2,
868
- useGrouping: false
869
- }) + "h" + (time % TimeInMinutes.HOUR).toLocaleString(undefined, {
870
- minimumIntegerDigits: 2,
871
- useGrouping: false
872
- }) + "min";
873
- }
848
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
849
+ var units = [{
850
+ label: 'yr',
851
+ value: TimeInMinutes.YEAR,
852
+ plural: 's'
853
+ }, {
854
+ label: 'mo',
855
+ value: TimeInMinutes.MONTH,
856
+ plural: 's'
857
+ }, {
858
+ label: 'd',
859
+ value: TimeInMinutes.DAY
860
+ }, {
861
+ label: 'h',
862
+ value: TimeInMinutes.HOUR
863
+ }, {
864
+ label: 'm',
865
+ value: TimeInMinutes.MINUTE
866
+ }];
867
+ var durations = units.reduce(function (units, duration) {
868
+ var min = units.min,
869
+ time = units.time,
870
+ count = units.count;
871
+ var label = duration.label,
872
+ value = duration.value,
873
+ _a = duration.plural,
874
+ plural = _a === void 0 ? '' : _a;
875
+ var unit = Math.floor(min / value);
876
+
877
+ if (unit > 0 && count < 2) {
878
+ return {
879
+ time: "" + time + unit + label + (unit > 1 ? plural : '') + " ",
880
+ min: min - unit * value,
881
+ count: count + 1
882
+ };
883
+ }
874
884
 
875
- return dateStr;
885
+ return {
886
+ min: min,
887
+ time: time,
888
+ count: count
889
+ };
890
+ }, {
891
+ min: minutes,
892
+ time: '',
893
+ count: 0
894
+ });
895
+ return durations.time.trim();
876
896
  };
877
897
 
878
- var TimeSliderUtils = /*#__PURE__*/Object.freeze({
898
+ var timeSliderUtils = /*#__PURE__*/Object.freeze({
879
899
  __proto__: null,
880
900
  millisecondsInSecond: millisecondsInSecond,
881
901
  defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
@@ -10595,7 +10615,6 @@
10595
10615
  return currentStyle === style.name;
10596
10616
  });
10597
10617
  return /*#__PURE__*/React__namespace.createElement(shared.TooltipSelect, {
10598
- disableUnderline: true,
10599
10618
  tooltip: "Style: " + ((_b = styles[currentIndex]) === null || _b === void 0 ? void 0 : _b.title),
10600
10619
  inputProps: {
10601
10620
  SelectDisplayProps: {
@@ -10638,51 +10657,108 @@
10638
10657
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
10639
10658
  * */
10640
10659
 
10641
- var makeIconStyle = function makeIconStyle(isActive, isEnabled) {
10642
- return {
10643
- color: function color() {
10644
- if (isActive) {
10645
- return 'common.white';
10646
- }
10660
+ var getIconColor = function getIconColor(isActive, isEnabled) {
10661
+ if (isActive) {
10662
+ return 'common.white';
10663
+ }
10647
10664
 
10648
- if (isEnabled) {
10649
- return 'geowebColors.buttons.flat.default.color';
10650
- }
10665
+ if (isEnabled) {
10666
+ return 'geowebColors.buttons.flat.default.color';
10667
+ }
10651
10668
 
10652
- return 'geowebColors.buttons.flat.disabled.color';
10653
- }
10654
- };
10669
+ return 'geowebColors.buttons.flat.disabled.color';
10655
10670
  };
10656
10671
 
10657
10672
  var ActivateLayer = function ActivateLayer(_a) {
10658
- var _b = _a.tooltipTitle,
10659
- tooltipTitle = _b === void 0 ? 'Leading layer' : _b,
10660
- onClickActivate = _a.onClickActivate,
10661
- _c = _a.isActive,
10662
- isActive = _c === void 0 ? false : _c,
10663
- _d = _a.isEnabled,
10664
- isEnabled = _d === void 0 ? true : _d,
10665
- _e = _a.id,
10666
- id = _e === void 0 ? 'activateLayer-btn' : _e;
10667
- var iconStyle = makeIconStyle(isActive, isEnabled);
10673
+ var _onChange = _a.onChange,
10674
+ isActive = _a.isActive,
10675
+ isEnabled = _a.isEnabled;
10676
+ return /*#__PURE__*/React__namespace.createElement(shared.TooltipSelect, {
10677
+ variant: "standard",
10678
+ tooltip: "Auto update",
10679
+ // Don't show arrow https://stackoverflow.com/questions/69085735/how-to-remove-arrow-from-react-textfield-select
10680
+ inputProps: {
10681
+ IconComponent: function IconComponent() {
10682
+ return null;
10683
+ }
10684
+ },
10685
+ value: isActive ? 'Both' : 'None',
10686
+ sx: {
10687
+ '&& .MuiOutlinedInput-input': {
10688
+ padding: '0'
10689
+ },
10690
+ '&&& .MuiInput-input': {
10691
+ paddingRight: 0
10692
+ }
10693
+ },
10694
+ renderValue: function renderValue(optionSelected) {
10695
+ return /*#__PURE__*/React__namespace.createElement(AutoUpdateButton$1, {
10696
+ optionSelected: optionSelected,
10697
+ isActive: isActive,
10698
+ isEnabled: isEnabled
10699
+ });
10700
+ },
10701
+ onChange: function onChange(event) {
10702
+ event.stopPropagation();
10668
10703
 
10669
- var onClick = function onClick(event) {
10670
- event.stopPropagation();
10671
- onClickActivate();
10672
- };
10704
+ _onChange(event.target.value === 'Both');
10705
+ },
10706
+ onClose: function onClose(event) {
10707
+ event.stopPropagation();
10708
+ }
10709
+ }, /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
10710
+ disabled: true
10711
+ }, "Auto-update"), /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
10712
+ value: "None"
10713
+ }, /*#__PURE__*/React__namespace.createElement(AutoOption, {
10714
+ icon: /*#__PURE__*/React__namespace.createElement(theme.None, null),
10715
+ text: "None"
10716
+ })), /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
10717
+ value: "Both"
10718
+ }, /*#__PURE__*/React__namespace.createElement(AutoOption, {
10719
+ icon: /*#__PURE__*/React__namespace.createElement(theme.Both, null),
10720
+ text: "Both"
10721
+ })));
10722
+ };
10673
10723
 
10674
- return /*#__PURE__*/React__namespace.createElement(shared.ManagerButton, {
10675
- tooltipTitle: tooltipTitle,
10676
- onClick: onClick,
10677
- icon: isActive ? /*#__PURE__*/React__namespace.createElement(theme.Both, {
10678
- sx: iconStyle
10679
- }) : /*#__PURE__*/React__namespace.createElement(theme.None, {
10680
- sx: iconStyle
10681
- }),
10682
- testId: id,
10683
- isActive: isActive,
10684
- className: "activateLayer-btn"
10724
+ var AutoUpdateButton$1 = function AutoUpdateButton(_a) {
10725
+ var optionSelected = _a.optionSelected,
10726
+ isActive = _a.isActive,
10727
+ isEnabled = _a.isEnabled;
10728
+ var style = {
10729
+ backgroundColor: isActive ? 'geowebColors.buttons.primary.active.fill' : 'transparent!important',
10730
+ borderRadius: '5px',
10731
+ color: getIconColor(isActive, isEnabled)
10732
+ };
10733
+ var Icon = isActive ? /*#__PURE__*/React__namespace.createElement(theme.Both, {
10734
+ sx: style
10735
+ }) : /*#__PURE__*/React__namespace.createElement(theme.None, {
10736
+ sx: style
10685
10737
  });
10738
+ return /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
10739
+ "data-testid": "activateLayer-btn",
10740
+ "aria-label": "Auto update " + optionSelected,
10741
+ sx: {
10742
+ '&.MuiButtonBase-root': {
10743
+ backgroundColor: 'transparent'
10744
+ }
10745
+ }
10746
+ }, Icon);
10747
+ };
10748
+
10749
+ var AutoOption = function AutoOption(_a) {
10750
+ var icon = _a.icon,
10751
+ text = _a.text;
10752
+ return /*#__PURE__*/React__namespace.createElement(material.Box, {
10753
+ sx: {
10754
+ display: 'flex',
10755
+ alignItems: 'center'
10756
+ }
10757
+ }, /*#__PURE__*/React__namespace.createElement(material.ListItemText, {
10758
+ sx: {
10759
+ width: '112px'
10760
+ }
10761
+ }, text), /*#__PURE__*/React__namespace.createElement(material.ListItemIcon, null, icon));
10686
10762
  };
10687
10763
 
10688
10764
  /* *
@@ -10748,8 +10824,8 @@
10748
10824
  borderRadius: 1,
10749
10825
  marginBottom: 0.5,
10750
10826
  minHeight: '34px',
10751
- '&.sortable-drag': {
10752
- boxShadow: 4
10827
+ '&.sortable-chosen': {
10828
+ boxShadow: 1
10753
10829
  },
10754
10830
  '&.sortable-ghost': {
10755
10831
  opacity: 0.5
@@ -10781,8 +10857,9 @@
10781
10857
  },
10782
10858
  id: "enableButton-medium"
10783
10859
  }), layerActiveLayout || /*#__PURE__*/React__default["default"].createElement(ActivateLayer, {
10784
- onClickActivate: onClickRow,
10785
- id: "activateLayer-btn-medium"
10860
+ onChange: onClickRow,
10861
+ isActive: false,
10862
+ isEnabled: true
10786
10863
  }), /*#__PURE__*/React__default["default"].createElement(material.Typography, {
10787
10864
  sx: {
10788
10865
  fontWeight: '500',
@@ -10861,7 +10938,9 @@
10861
10938
  });
10862
10939
  }
10863
10940
  }), layerActiveLayout || /*#__PURE__*/React__default["default"].createElement(ActivateLayer, {
10864
- onClickActivate: onClickRow
10941
+ onChange: onClickRow,
10942
+ isActive: false,
10943
+ isEnabled: true
10865
10944
  })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
10866
10945
  item: true,
10867
10946
  className: columnClasses.column2
@@ -11484,11 +11563,10 @@
11484
11563
  }, [dispatch]);
11485
11564
  var isActive = activeLayerId === layerId;
11486
11565
  return /*#__PURE__*/React__namespace.createElement(ActivateLayer, {
11487
- tooltipTitle: "Leading layer",
11488
- onClickActivate: function onClickActivate() {
11566
+ onChange: function onChange(isActive) {
11489
11567
  setActiveLayerId({
11490
11568
  mapId: mapId,
11491
- layerId: layerId
11569
+ layerId: isActive ? layerId : undefined
11492
11570
  });
11493
11571
 
11494
11572
  if (isAutoUpdating$1) {
@@ -11612,7 +11690,9 @@
11612
11690
  _c = _a.index,
11613
11691
  index = _c === void 0 ? undefined : _c,
11614
11692
  _d = _a.hideTooltip,
11615
- hideTooltip = _d === void 0 ? false : _d;
11693
+ hideTooltip = _d === void 0 ? false : _d,
11694
+ _e = _a.isSorting,
11695
+ isSorting = _e === void 0 ? false : _e;
11616
11696
  var tooltipTitle = hideTooltip ? '' : TOOLTIP_TITLE;
11617
11697
  return /*#__PURE__*/React__default["default"].createElement(shared.ManagerButton, {
11618
11698
  tooltipTitle: tooltipTitle,
@@ -11626,7 +11706,7 @@
11626
11706
  disabled: isDisabled,
11627
11707
  isAccessible: true,
11628
11708
  sx: {
11629
- cursor: 'grab',
11709
+ cursor: isSorting ? 'grabbing' : 'grab',
11630
11710
  '&:hover': {
11631
11711
  backgroundColor: 'inherit!important'
11632
11712
  },
@@ -11688,7 +11768,7 @@
11688
11768
  var onStart = React__namespace.useCallback(function (_a) {
11689
11769
  var oldIndex = _a.oldIndex;
11690
11770
  setActiveDragIndex(oldIndex);
11691
- Sortable__default["default"].ghost.style.opacity = '1';
11771
+ if (Sortable__default["default"].ghost) Sortable__default["default"].ghost.style.opacity = '1';
11692
11772
  }, []);
11693
11773
  var onEnd = React__namespace.useCallback(function () {
11694
11774
  if (activeDragIndex !== null) {
@@ -11768,12 +11848,11 @@
11768
11848
  handle: ".handle",
11769
11849
  direction: "vertical",
11770
11850
  // hover props
11771
- forceFallback: true,
11851
+ forceFallback: false,
11772
11852
  onStart: onStart,
11773
11853
  onEnd: onEnd,
11774
11854
  style: {
11775
- width: '100%',
11776
- cursor: isSorting ? 'grabbing' : 'inherit'
11855
+ width: '100%'
11777
11856
  }
11778
11857
  }, layerIds.map(function (layerId, index) {
11779
11858
  return /*#__PURE__*/React__namespace.createElement(LayerRowConnect, {
@@ -11784,7 +11863,8 @@
11784
11863
  dragHandle: /*#__PURE__*/React__namespace.createElement(DragHandle, {
11785
11864
  isDisabled: isDragDisabled,
11786
11865
  index: index,
11787
- hideTooltip: isSorting || isDragDisabled
11866
+ hideTooltip: isSorting || isDragDisabled,
11867
+ isSorting: isSorting
11788
11868
  })
11789
11869
  });
11790
11870
  })));
@@ -17237,7 +17317,8 @@
17237
17317
  icon = _a.icon,
17238
17318
  _b = _a.onChangeMouseWheel,
17239
17319
  onChangeMouseWheel = _b === void 0 ? function () {} : _b,
17240
- animationLength = _a.animationLength;
17320
+ displayVariableDuration = _a.displayVariableDuration,
17321
+ layerHasTimeStep = _a.layerHasTimeStep;
17241
17322
  var currentMarkIndex = marks.findIndex(function (mark) {
17242
17323
  return mark.value === value;
17243
17324
  });
@@ -17277,11 +17358,12 @@
17277
17358
  },
17278
17359
  ref: setAnchorRef,
17279
17360
  active: true,
17280
- width: "58px",
17361
+ width: "100%",
17281
17362
  onWheel: onWheel
17282
- }, icon, /*#__PURE__*/React__namespace.createElement(theme.TextIcon, {
17283
- text: currentMark === null || currentMark === void 0 ? void 0 : currentMark.text
17284
- }))), /*#__PURE__*/React__namespace.createElement(material.Menu, {
17363
+ }, icon, /*#__PURE__*/React__namespace.createElement(material.Typography, {
17364
+ fontSize: 12,
17365
+ fontWeight: 400
17366
+ }, displayVariableDuration ? minutesToDescribedDuration(value) : currentMark === null || currentMark === void 0 ? void 0 : currentMark.text))), /*#__PURE__*/React__namespace.createElement(material.Menu, {
17285
17367
  anchorEl: anchorRef,
17286
17368
  open: open,
17287
17369
  onClose: function onClose() {
@@ -17317,7 +17399,7 @@
17317
17399
  setOpen(false);
17318
17400
  },
17319
17401
  key: mark.value,
17320
- selected: (currentMark === null || currentMark === void 0 ? void 0 : currentMark.value) === mark.value,
17402
+ selected: (currentMark === null || currentMark === void 0 ? void 0 : currentMark.value) === mark.value && !isAutoSelected,
17321
17403
  disabled: isDisabled
17322
17404
  }, mark.label || mark.text);
17323
17405
  }), handleAutoClick && /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
@@ -17326,8 +17408,8 @@
17326
17408
  setOpen(false);
17327
17409
  },
17328
17410
  selected: isAutoSelected,
17329
- disabled: isDisabled
17330
- }, "Auto"), animationLength && /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
17411
+ disabled: isDisabled || !layerHasTimeStep
17412
+ }, "Auto"), displayVariableDuration && /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
17331
17413
  disabled: true,
17332
17414
  sx: {
17333
17415
  fontSize: '12px',
@@ -17337,12 +17419,12 @@
17337
17419
  minHeight: '30px!important'
17338
17420
  }
17339
17421
  }
17340
- }, "length"), animationLength && /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
17422
+ }, "length"), displayVariableDuration && /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
17341
17423
  "data-testid": "menu-animation-length-button",
17342
17424
  active: false,
17343
17425
  disableRipple: true,
17344
17426
  width: "100%"
17345
- }, minutesToDescribedDuration(animationLength))));
17427
+ }, minutesToDescribedDuration(value))));
17346
17428
  };
17347
17429
 
17348
17430
  /* *
@@ -17474,16 +17556,16 @@
17474
17556
  text: '2w'
17475
17557
  }, {
17476
17558
  label: '1 month',
17477
- value: 40320,
17478
- text: '4w'
17559
+ value: 43800,
17560
+ text: '1mo'
17479
17561
  }, {
17480
17562
  label: '2 months',
17481
- value: 80640,
17482
- text: '8w'
17563
+ value: 87600,
17564
+ text: '2mos'
17483
17565
  }, {
17484
17566
  label: '6 months',
17485
- value: 241920,
17486
- text: '24w'
17567
+ value: 262800,
17568
+ text: '6mos'
17487
17569
  }, {
17488
17570
  label: '1 year',
17489
17571
  value: 525600,
@@ -17498,15 +17580,17 @@
17498
17580
  var timeStepTitle = 'Time step';
17499
17581
 
17500
17582
  var TimeStepButton = function TimeStepButton(_a) {
17501
- var timeStep = _a.timeStep,
17502
- _b = _a.disabled,
17503
- disabled = _b === void 0 ? false : _b,
17583
+ var _b = _a.timeStep,
17584
+ timeStep = _b === void 0 ? marks$2[0].value : _b,
17585
+ _c = _a.disabled,
17586
+ disabled = _c === void 0 ? false : _c,
17504
17587
  isTimestepAuto = _a.isTimestepAuto,
17505
17588
  onChangeTimeStep = _a.onChangeTimeStep,
17506
- _c = _a.onToggleTimestepAuto,
17507
- onToggleTimestepAuto = _c === void 0 ? function () {} : _c,
17508
- _d = _a.isOpenByDefault,
17509
- isOpenByDefault = _d === void 0 ? false : _d;
17589
+ _d = _a.onToggleTimestepAuto,
17590
+ onToggleTimestepAuto = _d === void 0 ? function () {} : _d,
17591
+ _e = _a.isOpenByDefault,
17592
+ isOpenByDefault = _e === void 0 ? false : _e,
17593
+ timeStepFromLayer = _a.timeStepFromLayer;
17510
17594
 
17511
17595
  var handleMenuItemClick = function handleMenuItemClick(mark) {
17512
17596
  if (isTimestepAuto) {
@@ -17516,6 +17600,12 @@
17516
17600
  onChangeTimeStep(mark.value, MapActionOrigin.map);
17517
17601
  };
17518
17602
 
17603
+ var handleToggleTimeStep = function handleToggleTimeStep() {
17604
+ if (isTimestepAuto) return;
17605
+ onToggleTimestepAuto();
17606
+ timeStepFromLayer && onChangeTimeStep(timeStepFromLayer, MapActionOrigin.map);
17607
+ };
17608
+
17519
17609
  return /*#__PURE__*/React__namespace.createElement(TimeSliderMenu, {
17520
17610
  title: timeStepTitle,
17521
17611
  isOpenByDefault: isOpenByDefault,
@@ -17524,9 +17614,11 @@
17524
17614
  handleMenuItemClick: handleMenuItemClick,
17525
17615
  isDisabled: disabled,
17526
17616
  isAutoSelected: isTimestepAuto,
17527
- handleAutoClick: onToggleTimestepAuto,
17617
+ handleAutoClick: handleToggleTimeStep,
17528
17618
  icon: /*#__PURE__*/React__namespace.createElement(theme.FastForward, null),
17529
- onChangeMouseWheel: handleMenuItemClick
17619
+ onChangeMouseWheel: handleMenuItemClick,
17620
+ displayVariableDuration: true,
17621
+ layerHasTimeStep: Boolean(timeStepFromLayer)
17530
17622
  });
17531
17623
  };
17532
17624
 
@@ -17710,7 +17802,6 @@
17710
17802
  disabled = _b === void 0 ? false : _b,
17711
17803
  _c = _a.animationLength,
17712
17804
  animationLength = _c === void 0 ? AnimationLength.Hours1 : _c,
17713
- animationLengthInMinutes = _a.animationLengthInMinutes,
17714
17805
  onChangeAnimationLength = _a.onChangeAnimationLength;
17715
17806
 
17716
17807
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -17730,7 +17821,7 @@
17730
17821
  isDisabled: disabled,
17731
17822
  value: animationLength,
17732
17823
  onChangeMouseWheel: onChangeSliderValue,
17733
- animationLength: animationLengthInMinutes
17824
+ displayVariableDuration: true
17734
17825
  });
17735
17826
  };
17736
17827
 
@@ -17778,7 +17869,6 @@
17778
17869
  item: true,
17779
17870
  xs: "auto"
17780
17871
  }, timeStepBtn || /*#__PURE__*/React__default["default"].createElement(TimeStepButton, {
17781
- timeStep: 0,
17782
17872
  onChangeTimeStep: function onChangeTimeStep() {},
17783
17873
  isTimestepAuto: false
17784
17874
  })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
@@ -19385,6 +19475,26 @@
19385
19475
  ctx.restore();
19386
19476
  };
19387
19477
 
19478
+ var drawAutoUpdateIcon = function drawAutoUpdateIcon(ctx, x, y, theme, isAutoUpdating) {
19479
+ ctx.save();
19480
+ ctx.translate(x, y);
19481
+ var playerTimeText = theme.palette.geowebColors.timeSlider.playerTimeText;
19482
+ ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4';
19483
+ var path = new Path2D('M12.385 3.295l5 3-5 3V7.723l-.085.014c-3.08.548-5.418 3.24-5.418 6.479 0 3.634 2.945 6.58 6.577 6.58 2.914 0 5.385-1.896 6.248-4.523l2.815-1.626c-.225 4.814-4.197 8.648-9.063 8.648-5.012 0-9.074-4.065-9.074-9.08 0-4.65 3.495-8.484 8-9.015V3.295z');
19484
+ ctx.translate(7, -8);
19485
+ ctx.rotate(13.295);
19486
+ ctx.fill(path);
19487
+ ctx.restore();
19488
+ var text = 'Auto';
19489
+ ctx.save();
19490
+ ctx.translate(x, y);
19491
+ ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4'; // ON
19492
+
19493
+ ctx.font = "7px " + playerTimeText.fontFamily;
19494
+ ctx.fillText(text, 5, 14);
19495
+ ctx.restore();
19496
+ };
19497
+
19388
19498
  var drawTextAnnotation = function drawTextAnnotation(ctx, x, y, text, theme) {
19389
19499
  var playerTimeText = theme.palette.geowebColors.timeSlider.playerTimeText;
19390
19500
  ctx.save();
@@ -19398,20 +19508,22 @@
19398
19508
  ctx.restore();
19399
19509
  };
19400
19510
 
19401
- var drawNewCurrentTimeBox = function drawNewCurrentTimeBox(ctx, selectedTime, selectedPx, scale, theme) {
19511
+ var drawNewCurrentTimeBox = function drawNewCurrentTimeBox(ctx, selectedTime, selectedPx, scale, theme, isAutoUpdating) {
19512
+ var iconWidth = 25;
19402
19513
  var smallWidth = needleGeom.smallWidth,
19403
19514
  largeWidth = needleGeom.largeWidth,
19404
19515
  height = needleGeom.height;
19405
- var needleWidth = scale === Scale.Year ? largeWidth : smallWidth;
19406
- var needleX = selectedPx - needleWidth / 2;
19516
+ var boxWidth = scale === Scale.Year ? largeWidth : smallWidth;
19517
+ var needleX = selectedPx - boxWidth / 2;
19407
19518
  var needleY = needleGeom.lineWidth;
19408
- drawRoundedRectangle(ctx, needleX, needleY, needleWidth, height, needleGeom.cornerRadius, theme);
19519
+ drawRoundedRectangle(ctx, needleX - iconWidth, needleY, boxWidth + iconWidth, height, needleGeom.cornerRadius, theme);
19409
19520
  var timeFormat = scale === Scale.Year ? 'Y ddd DD MMM HH:mm' : 'ddd DD MMM HH:mm';
19410
19521
  var timeText = moment__default["default"].utc(selectedTime * 1000).format(timeFormat).toString();
19411
- drawTextAnnotation(ctx, needleX + needleWidth / 2, needleY + height / 2, timeText, theme);
19522
+ drawTextAnnotation(ctx, needleX + boxWidth / 2 - iconWidth, needleY + height / 2, timeText, theme);
19523
+ drawAutoUpdateIcon(ctx, needleX + boxWidth - iconWidth, needleY, theme, isAutoUpdating);
19412
19524
  };
19413
19525
 
19414
- var renderTimeSliderCurrentTimeBox = function renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selected, secondsPerPx, scale) {
19526
+ var renderTimeSliderCurrentTimeBox = function renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selected, secondsPerPx, scale, isAutoUpdating) {
19415
19527
  // map unix timestamps to pixel values
19416
19528
  var _a = __read([selected].map(function (t) {
19417
19529
  return timestampToPixel(t, centerTime, width, secondsPerPx);
@@ -19419,7 +19531,7 @@
19419
19531
  selectedPx = _a[0];
19420
19532
 
19421
19533
  ctx.clearRect(0, 0, width, height);
19422
- drawNewCurrentTimeBox(ctx, selected, selectedPx, scale, theme);
19534
+ drawNewCurrentTimeBox(ctx, selected, selectedPx, scale, theme, isAutoUpdating);
19423
19535
  };
19424
19536
 
19425
19537
  /* *
@@ -19451,6 +19563,7 @@
19451
19563
  dataStartTime = _a.dataStartTime,
19452
19564
  dataEndTime = _a.dataEndTime,
19453
19565
  unfilteredSelectedTime = _a.unfilteredSelectedTime,
19566
+ isAutoUpdating = _a.isAutoUpdating,
19454
19567
  onSetNewDate = _a.onSetNewDate,
19455
19568
  setUnfilteredSelectedTime = _a.setUnfilteredSelectedTime;
19456
19569
  var TIME_BOX_WIDTH = 140;
@@ -19531,7 +19644,7 @@
19531
19644
  },
19532
19645
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
19533
19646
  setCanvasWidth(width);
19534
- renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime, secondsPerPx, scale);
19647
+ renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime, secondsPerPx, scale, isAutoUpdating);
19535
19648
  }
19536
19649
  }));
19537
19650
  };
@@ -19805,26 +19918,15 @@
19805
19918
  var activeLayerTimeDimension = reactRedux.useSelector(function (store) {
19806
19919
  return getLayerTimeDimension(store, activeLayerId);
19807
19920
  });
19808
-
19809
- var onToggleTimestepAuto = function onToggleTimestepAuto() {
19810
- var newTimestepAuto = !isTimestepAuto$1;
19811
-
19812
- if (newTimestepAuto) {
19813
- var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
19814
-
19815
- if (timeStepFromLayer) {
19816
- dispatch(mapActions$1.setTimeStep({
19817
- mapId: mapId,
19818
- timeStep: timeStepFromLayer
19819
- }));
19820
- }
19821
- }
19822
-
19921
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
19922
+ var onToggleTimestepAuto = React__namespace.useCallback(function () {
19823
19923
  dispatch(mapActions$1.toggleTimestepAuto({
19824
19924
  mapId: mapId,
19825
- timestepAuto: newTimestepAuto
19925
+ timestepAuto: !isTimestepAuto$1,
19926
+ origin: MapActionOrigin.map
19826
19927
  }));
19827
- };
19928
+ }, [dispatch, isTimestepAuto$1, mapId]);
19929
+ var activeTimeStep = isTimestepAuto$1 && timeStepFromLayer ? timeStepFromLayer : timeStep;
19828
19930
 
19829
19931
  var onSetTimeStep = function onSetTimeStep(timeStep) {
19830
19932
  dispatch(mapActions$1.setTimeStep({
@@ -19834,11 +19936,12 @@
19834
19936
  };
19835
19937
 
19836
19938
  return /*#__PURE__*/React__namespace.createElement(TimeStepButton, {
19837
- timeStep: timeStep,
19939
+ timeStep: activeTimeStep,
19838
19940
  onChangeTimeStep: onSetTimeStep,
19839
19941
  disabled: isAnimating$1,
19840
19942
  onToggleTimestepAuto: onToggleTimestepAuto,
19841
- isTimestepAuto: Boolean(isTimestepAuto$1)
19943
+ isTimestepAuto: Boolean(isTimestepAuto$1) && Boolean(timeStepFromLayer),
19944
+ timeStepFromLayer: timeStepFromLayer
19842
19945
  });
19843
19946
  };
19844
19947
 
@@ -20002,11 +20105,6 @@
20002
20105
  return getAnimationEndTime$1(store, mapId);
20003
20106
  });
20004
20107
  var currentDiffInMinutes = moment__default["default"](animationEndTime).diff(moment__default["default"](animationStartTime), 'minutes');
20005
- var currentLength = Object.values(AnimationLength).map(function (val) {
20006
- return Number(val);
20007
- }).find(function (val) {
20008
- return val >= currentDiffInMinutes;
20009
- });
20010
20108
 
20011
20109
  var handlechangeAnimationLength = function handlechangeAnimationLength(length) {
20012
20110
  var animationEndTime = moment__default["default"](animationStartTime).add(length, 'minutes').toISOString();
@@ -20018,9 +20116,8 @@
20018
20116
 
20019
20117
  return /*#__PURE__*/React__namespace.createElement(AnimationLengthButton, {
20020
20118
  disabled: isAnimating$1,
20021
- animationLength: currentLength || Number(AnimationLength.Hours24),
20022
- onChangeAnimationLength: handlechangeAnimationLength,
20023
- animationLengthInMinutes: currentDiffInMinutes
20119
+ animationLength: currentDiffInMinutes || Number(AnimationLength.Hours24),
20120
+ onChangeAnimationLength: handlechangeAnimationLength
20024
20121
  });
20025
20122
  };
20026
20123
 
@@ -20349,6 +20446,7 @@
20349
20446
  scale: getMapTimeSliderScale(store, props.mapId),
20350
20447
  timeStep: getMapTimeStep(store, props.mapId),
20351
20448
  isAnimating: isAnimating(store, props.mapId),
20449
+ isAutoUpdating: isAutoUpdating(store, props.mapId),
20352
20450
  unfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime(store, props.mapId)
20353
20451
  };
20354
20452
  }, {
@@ -20367,6 +20465,7 @@
20367
20465
  layers = _a.layers,
20368
20466
  timeStep = _a.timeStep,
20369
20467
  isAnimating = _a.isAnimating,
20468
+ isAutoUpdating = _a.isAutoUpdating,
20370
20469
  stopMapAnimation = _a.stopMapAnimation,
20371
20470
  unfilteredSelectedTime = _a.unfilteredSelectedTime,
20372
20471
  setTimeSliderUnfilteredSelectedTime = _a.setTimeSliderUnfilteredSelectedTime,
@@ -20385,6 +20484,7 @@
20385
20484
  dataStartTime: dataStartTime,
20386
20485
  dataEndTime: dataEndTime,
20387
20486
  timeStep: timeStep,
20487
+ isAutoUpdating: isAutoUpdating,
20388
20488
  unfilteredSelectedTime: unfilteredSelectedTime || selectedTime,
20389
20489
  setUnfilteredSelectedTime: function setUnfilteredSelectedTime(timeSliderUnfilteredSelectedTime) {
20390
20490
  if (setTimeSliderUnfilteredSelectedTime) setTimeSliderUnfilteredSelectedTime({
@@ -27378,7 +27478,7 @@
27378
27478
  exports.synchronizationGroupModuleConfig = synchronizationGroupConfig;
27379
27479
  exports.synchronizationGroupsConfig = synchronizationGroupConfig;
27380
27480
  exports.testLayers = testLayers;
27381
- exports.timeSliderUtils = TimeSliderUtils;
27481
+ exports.timeSliderUtils = timeSliderUtils;
27382
27482
  exports.uiActions = uiActions;
27383
27483
  exports.uiModuleConfig = uiModuleConfig;
27384
27484
  exports.uiSelectors = selectors$1;