@opengeoweb/time-slider 14.4.0 → 14.5.1
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 +710 -721
- package/package.json +3 -3
- package/src/lib/Providers/Providers.d.ts +1 -1
- package/src/lib/components/TimeSlider/TimeSlider.d.ts +1 -1
- package/src/lib/components/TimeSlider/timeSliderUtils.d.ts +1 -10
- package/src/lib/components/TimeSliderButtons/AutoUpdateButton/AutoUpdateButton.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/ControlButtons/ControlButtons.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/NowButton/NowButton.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenu.d.ts +2 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +2 -1
- package/src/lib/components/TimeSliderButtons/PlayButton/PlayButton.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/SpeedButton/SpeedButton.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.d.ts +1 -1
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.d.ts +1 -1
- package/src/lib/components/TimeSliderClock/ClockContainer.d.ts +1 -1
- package/src/lib/components/TimeSliderClock/PopperMenu.d.ts +2 -1
- package/src/lib/components/TimeSliderClock/TimeSliderClock.d.ts +2 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/CalendarButton/CalendarButton.d.ts +1 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/MarkerTimeSelector/MarkerTimeSelector.d.ts +1 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxRenderFunctions.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawBackground.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawCurrentTime.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawNeedle.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeScale.d.ts +1 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeSliderLegend.d.ts +1 -1
- package/src/lib/utils/i18n.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Grid, Typography, Box, Menu, MenuItem, CardHeader, FormControl, TextField, Select, Popper, Paper, useTheme, Stack, InputAdornment, ClickAwayListener } from '@mui/material';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import React, { useState, useRef, useEffect, createElement } from 'react';
|
|
4
|
+
import { dateUtils, safelyInitI18nForTestsAndStories, CustomIconButton, CustomTooltip, renderCounter, useMakeSureContainerStaysInsideWindow, CanvasComponent, CustomToggleButton } from '@opengeoweb/shared';
|
|
5
|
+
import { debounce, throttle } from 'lodash';
|
|
6
|
+
import { ChevronDown, ChevronUp, ChevronRight, ChevronLeft, AutoUpdateActive, AutoUpdateInActive, StepForward, StepBackward, Now, Pause, Play, Edit, Animation, Speed, Clock, FastForward, Resize, dragHandlePath, Options, CalendarToday, ThemeWrapper, lightTheme, darkTheme } from '@opengeoweb/theme';
|
|
7
7
|
import i18n from 'i18next';
|
|
8
8
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
9
|
-
import { debounce, throttle } from 'lodash';
|
|
10
|
-
import Draggable from 'react-draggable';
|
|
11
9
|
import { Resizable } from 're-resizable';
|
|
10
|
+
import Draggable from 'react-draggable';
|
|
12
11
|
import { Box as Box$1 } from '@mui/system';
|
|
12
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
13
13
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
14
14
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
15
|
-
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
16
15
|
import { PickersDay } from '@mui/x-date-pickers/PickersDay';
|
|
17
16
|
|
|
18
17
|
var en = {
|
|
@@ -223,51 +222,6 @@ var timesliderTranslations = {
|
|
|
223
222
|
nl: nl
|
|
224
223
|
};
|
|
225
224
|
|
|
226
|
-
/* *
|
|
227
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
228
|
-
* you may not use this file except in compliance with the License.
|
|
229
|
-
* You may obtain a copy of the License at
|
|
230
|
-
*
|
|
231
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
232
|
-
*
|
|
233
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
234
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
235
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
236
|
-
* See the License for the specific language governing permissions and
|
|
237
|
-
* limitations under the License.
|
|
238
|
-
*
|
|
239
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
240
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
241
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
242
|
-
* */
|
|
243
|
-
var TIME_SLIDER_NAMESPACE = 'timeslider';
|
|
244
|
-
var initTimesliderI18n = function initTimesliderI18n() {
|
|
245
|
-
safelyInitI18nForTestsAndStories(i18n, TIME_SLIDER_NAMESPACE, [{
|
|
246
|
-
ns: TIME_SLIDER_NAMESPACE,
|
|
247
|
-
translations: timesliderTranslations
|
|
248
|
-
}]);
|
|
249
|
-
};
|
|
250
|
-
var useTimesliderTranslation = function useTimesliderTranslation() {
|
|
251
|
-
return useTranslation(TIME_SLIDER_NAMESPACE);
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
var HideSliderButtonComponent = function HideSliderButtonComponent(_ref) {
|
|
255
|
-
var isVisible = _ref.isVisible,
|
|
256
|
-
toggleTimeSliderIsVisible = _ref.toggleTimeSliderIsVisible;
|
|
257
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
258
|
-
t = _useTimesliderTransla.t;
|
|
259
|
-
return jsx(CustomIconButton, {
|
|
260
|
-
variant: "tool",
|
|
261
|
-
onClick: function onClick() {
|
|
262
|
-
toggleTimeSliderIsVisible(!isVisible);
|
|
263
|
-
},
|
|
264
|
-
"data-testid": "hideTimeSliderButton",
|
|
265
|
-
tooltipTitle: isVisible ? t('timeslider-hide') : t('timeslider-show'),
|
|
266
|
-
children: isVisible ? jsx(ChevronDown, {}) : jsx(ChevronUp, {})
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
var HideSliderButton = /*#__PURE__*/React__default.memo(HideSliderButtonComponent);
|
|
270
|
-
|
|
271
225
|
function _arrayLikeToArray(r, a) {
|
|
272
226
|
(null == a || a > r.length) && (a = r.length);
|
|
273
227
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -406,15 +360,15 @@ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePo
|
|
|
406
360
|
* ...
|
|
407
361
|
*/
|
|
408
362
|
var useCanvasTarget = function useCanvasTarget(eventType) {
|
|
409
|
-
var nodeRef =
|
|
410
|
-
var _React$useState =
|
|
363
|
+
var nodeRef = React.useRef(null);
|
|
364
|
+
var _React$useState = React.useState(false),
|
|
411
365
|
isTargetNode = _React$useState[0],
|
|
412
|
-
|
|
366
|
+
setIsTargetNode = _React$useState[1];
|
|
413
367
|
// Check if pointer event targets current node element
|
|
414
|
-
var pointerEventListener =
|
|
415
|
-
|
|
368
|
+
var pointerEventListener = React.useCallback(function (event) {
|
|
369
|
+
setIsTargetNode(nodeRef.current.canvas ? nodeRef.current.canvas.isEqualNode(event.target) : false);
|
|
416
370
|
}, [nodeRef]);
|
|
417
|
-
|
|
371
|
+
React.useEffect(function () {
|
|
418
372
|
document.addEventListener(eventType, pointerEventListener);
|
|
419
373
|
return function () {
|
|
420
374
|
return document.removeEventListener(eventType, pointerEventListener);
|
|
@@ -572,15 +526,6 @@ var calculateMouseTimeAndCheckBounds = function calculateMouseTimeAndCheckBounds
|
|
|
572
526
|
tooltipPosition.current = pixelsBetweenViewportAndTimesliderOnLeft && mousePosition + pixelsBetweenViewportAndTimesliderOnLeft;
|
|
573
527
|
return pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
|
|
574
528
|
};
|
|
575
|
-
var MockDOMRect = function MockDOMRect(x, y, width, height) {
|
|
576
|
-
this.x = x;
|
|
577
|
-
this.y = y;
|
|
578
|
-
this.width = width;
|
|
579
|
-
this.height = height;
|
|
580
|
-
}; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
581
|
-
var setTooltipPosition = function setTooltipPosition(tooltipX, tooltipY) {
|
|
582
|
-
return new MockDOMRect(tooltipX, tooltipY, 0, 0);
|
|
583
|
-
};
|
|
584
529
|
// default values
|
|
585
530
|
var defaultAnimationDelayAtStart = 250;
|
|
586
531
|
var defaultDelay = 1000; // [ms]
|
|
@@ -651,7 +596,6 @@ var timeSliderUtils = /*#__PURE__*/Object.freeze({
|
|
|
651
596
|
secondsPerPxFromCanvasWidth: secondsPerPxFromCanvasWidth,
|
|
652
597
|
secondsPerPxToScale: secondsPerPxToScale,
|
|
653
598
|
secondsPerPxValues: secondsPerPxValues,
|
|
654
|
-
setTooltipPosition: setTooltipPosition,
|
|
655
599
|
spanToScale: spanToScale,
|
|
656
600
|
speedFactors: speedFactors,
|
|
657
601
|
timeBoxGeom: timeBoxGeom,
|
|
@@ -753,7 +697,7 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
|
|
|
753
697
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
754
698
|
* */
|
|
755
699
|
var useToggleTimesliderVisibility = function useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider) {
|
|
756
|
-
|
|
700
|
+
React.useEffect(function () {
|
|
757
701
|
var handleKeyDown = function handleKeyDown(event) {
|
|
758
702
|
var target = event.target;
|
|
759
703
|
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && (event.key === 't' || event.key === 'T') && mapIsActive) {
|
|
@@ -767,7 +711,7 @@ var useToggleTimesliderVisibility = function useToggleTimesliderVisibility(mapIs
|
|
|
767
711
|
}, [mapIsActive, isVisible, onToggleTimeSlider]);
|
|
768
712
|
};
|
|
769
713
|
var useMoveTimeWithKeyboard = function useMoveTimeWithKeyboard(mapIsActive, timeStep, dataStartTime, dataEndTime, onSetNewDate, onSetCenterTime, selectedTime) {
|
|
770
|
-
|
|
714
|
+
React.useEffect(function () {
|
|
771
715
|
var handleKeyDown = function handleKeyDown(event) {
|
|
772
716
|
if (event.key === 'Home' && mapIsActive) {
|
|
773
717
|
handleSetNowEvent(timeStep, dataStartTime, dataEndTime, dateUtils.unix(dateUtils.utc()), onSetNewDate, onSetCenterTime);
|
|
@@ -792,6 +736,51 @@ var useMoveTimeWithKeyboard = function useMoveTimeWithKeyboard(mapIsActive, time
|
|
|
792
736
|
}, [dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, selectedTime, timeStep]);
|
|
793
737
|
};
|
|
794
738
|
|
|
739
|
+
/* *
|
|
740
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
741
|
+
* you may not use this file except in compliance with the License.
|
|
742
|
+
* You may obtain a copy of the License at
|
|
743
|
+
*
|
|
744
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
745
|
+
*
|
|
746
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
747
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
748
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
749
|
+
* See the License for the specific language governing permissions and
|
|
750
|
+
* limitations under the License.
|
|
751
|
+
*
|
|
752
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
753
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
754
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
755
|
+
* */
|
|
756
|
+
var TIME_SLIDER_NAMESPACE = 'timeslider';
|
|
757
|
+
var initTimesliderI18n = function initTimesliderI18n() {
|
|
758
|
+
safelyInitI18nForTestsAndStories(i18n, TIME_SLIDER_NAMESPACE, [{
|
|
759
|
+
ns: TIME_SLIDER_NAMESPACE,
|
|
760
|
+
translations: timesliderTranslations
|
|
761
|
+
}]);
|
|
762
|
+
};
|
|
763
|
+
var useTimesliderTranslation = function useTimesliderTranslation() {
|
|
764
|
+
return useTranslation(TIME_SLIDER_NAMESPACE);
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
var HideSliderButtonComponent = function HideSliderButtonComponent(_ref) {
|
|
768
|
+
var isVisible = _ref.isVisible,
|
|
769
|
+
toggleTimeSliderIsVisible = _ref.toggleTimeSliderIsVisible;
|
|
770
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
771
|
+
t = _useTimesliderTransla.t;
|
|
772
|
+
return jsx(CustomIconButton, {
|
|
773
|
+
"data-testid": "hideTimeSliderButton",
|
|
774
|
+
onClick: function onClick() {
|
|
775
|
+
toggleTimeSliderIsVisible(!isVisible);
|
|
776
|
+
},
|
|
777
|
+
tooltipTitle: isVisible ? t('timeslider-hide') : t('timeslider-show'),
|
|
778
|
+
variant: "tool",
|
|
779
|
+
children: isVisible ? jsx(ChevronDown, {}) : jsx(ChevronUp, {})
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
var HideSliderButton = /*#__PURE__*/React.memo(HideSliderButtonComponent);
|
|
783
|
+
|
|
795
784
|
/* *
|
|
796
785
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
797
786
|
* you may not use this file except in compliance with the License.
|
|
@@ -900,6 +889,7 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
900
889
|
// these components will always be created as TimeSlider never runs in isolation from the store
|
|
901
890
|
return isVisible ? jsxs(Grid, {
|
|
902
891
|
container: true,
|
|
892
|
+
"data-testid": "timeSlider",
|
|
903
893
|
sx: {
|
|
904
894
|
display: 'grid',
|
|
905
895
|
gridTemplateColumns: '175px 1fr 40px',
|
|
@@ -915,7 +905,6 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
915
905
|
paddingRight: '5%'
|
|
916
906
|
}
|
|
917
907
|
},
|
|
918
|
-
"data-testid": "timeSlider",
|
|
919
908
|
children: [jsx(Grid, {
|
|
920
909
|
sx: {
|
|
921
910
|
gridArea: 'timebox',
|
|
@@ -940,8 +929,8 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
940
929
|
paddingLeft: 1
|
|
941
930
|
},
|
|
942
931
|
children: jsx(HideSliderButton, {
|
|
943
|
-
|
|
944
|
-
|
|
932
|
+
isVisible: isVisible,
|
|
933
|
+
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
945
934
|
})
|
|
946
935
|
})]
|
|
947
936
|
}) : jsx(Grid, {
|
|
@@ -953,8 +942,8 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
953
942
|
justifyContent: 'flex-end'
|
|
954
943
|
},
|
|
955
944
|
children: jsx(HideSliderButton, {
|
|
956
|
-
|
|
957
|
-
|
|
945
|
+
isVisible: isVisible,
|
|
946
|
+
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
958
947
|
})
|
|
959
948
|
});
|
|
960
949
|
};
|
|
@@ -1058,7 +1047,6 @@ var ClockContainer = function ClockContainer(_ref) {
|
|
|
1058
1047
|
var currentDateString = dateToManualFormatString(dateUtils.fromUnix(time));
|
|
1059
1048
|
return jsxs(Grid, {
|
|
1060
1049
|
container: true,
|
|
1061
|
-
wrap: "nowrap",
|
|
1062
1050
|
sx: {
|
|
1063
1051
|
justifyContent: 'space-evenly',
|
|
1064
1052
|
alignItems: 'center',
|
|
@@ -1068,6 +1056,7 @@ var ClockContainer = function ClockContainer(_ref) {
|
|
|
1068
1056
|
backgroundColor: 'geowebColors.timeSlider.playerTimeMarkers.fill',
|
|
1069
1057
|
borderRadius: '5px'
|
|
1070
1058
|
},
|
|
1059
|
+
wrap: "nowrap",
|
|
1071
1060
|
children: [jsx(Grid, {
|
|
1072
1061
|
sx: {
|
|
1073
1062
|
width: '4px'
|
|
@@ -1080,13 +1069,13 @@ var ClockContainer = function ClockContainer(_ref) {
|
|
|
1080
1069
|
zIndex: 2
|
|
1081
1070
|
},
|
|
1082
1071
|
children: jsx(CustomIconButton, {
|
|
1083
|
-
|
|
1072
|
+
"aria-label": "Animation options",
|
|
1073
|
+
isSelected: isPopperOpen,
|
|
1084
1074
|
onClick: onButtonClick,
|
|
1085
1075
|
sx: {
|
|
1086
1076
|
color: '#fff!important'
|
|
1087
1077
|
},
|
|
1088
|
-
|
|
1089
|
-
isSelected: isPopperOpen,
|
|
1078
|
+
variant: "tool",
|
|
1090
1079
|
children: jsx(Icon, {
|
|
1091
1080
|
isPopperOpen: isPopperOpen,
|
|
1092
1081
|
popperPlacement: popperPlacement
|
|
@@ -1095,12 +1084,12 @@ var ClockContainer = function ClockContainer(_ref) {
|
|
|
1095
1084
|
})
|
|
1096
1085
|
}), jsx(Grid, {
|
|
1097
1086
|
children: jsx(Typography, {
|
|
1098
|
-
variant: "subtitle2",
|
|
1099
1087
|
sx: {
|
|
1100
1088
|
whiteSpace: 'nowrap',
|
|
1101
1089
|
fontSize: fontSize,
|
|
1102
1090
|
color: '#fff'
|
|
1103
1091
|
},
|
|
1092
|
+
variant: "subtitle2",
|
|
1104
1093
|
children: currentDateString
|
|
1105
1094
|
})
|
|
1106
1095
|
})]
|
|
@@ -1146,6 +1135,128 @@ var Icon = function Icon(_ref2) {
|
|
|
1146
1135
|
});
|
|
1147
1136
|
};
|
|
1148
1137
|
|
|
1138
|
+
var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
1139
|
+
var _ref$toggleAutoUpdate = _ref.toggleAutoUpdate,
|
|
1140
|
+
toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {} : _ref$toggleAutoUpdate,
|
|
1141
|
+
_ref$isAutoUpdating = _ref.isAutoUpdating,
|
|
1142
|
+
isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
|
|
1143
|
+
_ref$disabled = _ref.disabled,
|
|
1144
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
1145
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1146
|
+
t = _useTimesliderTransla.t;
|
|
1147
|
+
return jsx(CustomIconButton, {
|
|
1148
|
+
"data-testid": "autoUpdateButton",
|
|
1149
|
+
disabled: disabled,
|
|
1150
|
+
isSelected: isAutoUpdating,
|
|
1151
|
+
onClick: function onClick() {
|
|
1152
|
+
return toggleAutoUpdate();
|
|
1153
|
+
},
|
|
1154
|
+
tooltipTitle: isAutoUpdating ? t('timeslider-auto-update-on') : t('timeslider-auto-update-off'),
|
|
1155
|
+
variant: "tool",
|
|
1156
|
+
children: isAutoUpdating ? jsx(AutoUpdateActive, {
|
|
1157
|
+
"data-testid": "auto-update-svg-on"
|
|
1158
|
+
}) : jsx(AutoUpdateInActive, {
|
|
1159
|
+
"data-testid": "auto-update-svg-off"
|
|
1160
|
+
})
|
|
1161
|
+
});
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
1165
|
+
var isForwardStep = _ref.isForwardStep,
|
|
1166
|
+
isDisabled = _ref.isDisabled,
|
|
1167
|
+
_ref$onClickBFButton = _ref.onClickBFButton,
|
|
1168
|
+
onClickBFButton = _ref$onClickBFButton === void 0 ? function () {} : _ref$onClickBFButton;
|
|
1169
|
+
// Added renderCounter for testing and performance purposes
|
|
1170
|
+
renderCounter.count(BackwardForwardStepButton.name);
|
|
1171
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1172
|
+
t = _useTimesliderTransla.t;
|
|
1173
|
+
return jsx(CustomIconButton, {
|
|
1174
|
+
"aria-label": isForwardStep ? 'forward' : 'backward',
|
|
1175
|
+
"data-testid": isForwardStep ? 'stepForwardButton' : 'stepBackwardButton',
|
|
1176
|
+
disabled: isDisabled,
|
|
1177
|
+
onClick: onClickBFButton,
|
|
1178
|
+
tooltipTitle: isForwardStep ? t('timeslider-forward') : t('timeslider-backward'),
|
|
1179
|
+
variant: "tool",
|
|
1180
|
+
children: isForwardStep ? jsx(StepForward, {
|
|
1181
|
+
"data-testid": "step-forward-svg-path"
|
|
1182
|
+
}) : jsx(StepBackward, {
|
|
1183
|
+
"data-testid": "step-backward-svg-path"
|
|
1184
|
+
})
|
|
1185
|
+
});
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
var NowButton = function NowButton(_ref) {
|
|
1189
|
+
var _ref$onSetNow = _ref.onSetNow,
|
|
1190
|
+
onSetNow = _ref$onSetNow === void 0 ? function () {} : _ref$onSetNow,
|
|
1191
|
+
_ref$disabled = _ref.disabled,
|
|
1192
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
1193
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1194
|
+
t = _useTimesliderTransla.t;
|
|
1195
|
+
return jsx(CustomIconButton, {
|
|
1196
|
+
"aria-label": "now",
|
|
1197
|
+
"data-testid": "nowButtonTooltip",
|
|
1198
|
+
disabled: disabled,
|
|
1199
|
+
onClick: function onClick() {
|
|
1200
|
+
return onSetNow();
|
|
1201
|
+
},
|
|
1202
|
+
tooltipTitle: t('timeslider-now'),
|
|
1203
|
+
variant: "tool",
|
|
1204
|
+
children: jsx(Now, {
|
|
1205
|
+
"data-testid": "now-svg"
|
|
1206
|
+
})
|
|
1207
|
+
});
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
var PlayButton = function PlayButton(_ref) {
|
|
1211
|
+
var isAnimating = _ref.isAnimating,
|
|
1212
|
+
isDisabled = _ref.isDisabled,
|
|
1213
|
+
_ref$onTogglePlayButt = _ref.onTogglePlayButton,
|
|
1214
|
+
onTogglePlayButton = _ref$onTogglePlayButt === void 0 ? function () {} : _ref$onTogglePlayButt;
|
|
1215
|
+
var onTogglePlay = function onTogglePlay() {
|
|
1216
|
+
onTogglePlayButton();
|
|
1217
|
+
};
|
|
1218
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1219
|
+
t = _useTimesliderTransla.t;
|
|
1220
|
+
return jsx(CustomIconButton, {
|
|
1221
|
+
"data-testid": "playButton",
|
|
1222
|
+
disabled: isDisabled,
|
|
1223
|
+
isSelected: isAnimating,
|
|
1224
|
+
onClick: onTogglePlay,
|
|
1225
|
+
tooltipTitle: isAnimating ? t('timeslider-pause') : t('timeslider-play'),
|
|
1226
|
+
variant: "tool",
|
|
1227
|
+
children: isAnimating ? jsx(Pause, {
|
|
1228
|
+
"data-testid": "pause-svg-path"
|
|
1229
|
+
}) : jsx(Play, {
|
|
1230
|
+
"data-testid": "play-svg-path"
|
|
1231
|
+
})
|
|
1232
|
+
});
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
var ControlButtons = function ControlButtons(_ref) {
|
|
1236
|
+
var backwardBtn = _ref.backwardBtn,
|
|
1237
|
+
forwardBtn = _ref.forwardBtn,
|
|
1238
|
+
playBtn = _ref.playBtn,
|
|
1239
|
+
nowBtn = _ref.nowBtn,
|
|
1240
|
+
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
1241
|
+
return jsxs(Fragment, {
|
|
1242
|
+
children: [jsx(Grid, {
|
|
1243
|
+
children: backwardBtn || jsx(BackwardForwardStepButton, {
|
|
1244
|
+
isForwardStep: false
|
|
1245
|
+
})
|
|
1246
|
+
}), jsx(Grid, {
|
|
1247
|
+
children: forwardBtn || jsx(BackwardForwardStepButton, {
|
|
1248
|
+
isForwardStep: true
|
|
1249
|
+
})
|
|
1250
|
+
}), jsx(Grid, {
|
|
1251
|
+
children: playBtn || jsx(PlayButton, {})
|
|
1252
|
+
}), jsx(Grid, {
|
|
1253
|
+
children: nowBtn || jsx(NowButton, {})
|
|
1254
|
+
}), jsx(Grid, {
|
|
1255
|
+
children: autoUpdateBtn || jsx(AutoUpdateButton, {})
|
|
1256
|
+
})]
|
|
1257
|
+
});
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1149
1260
|
var THROTTLE_WAIT_TIME = 300; // [ms]
|
|
1150
1261
|
var THROTTLE_OPTIONS = {
|
|
1151
1262
|
trailing: false // Invoke function when called, but not more than once every <THROTTLE_WAIT_TIME>.
|
|
@@ -1181,10 +1292,10 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1181
1292
|
t = _useTimesliderTransla.t;
|
|
1182
1293
|
var _useState = useState(false),
|
|
1183
1294
|
displayLengthInputField = _useState[0],
|
|
1184
|
-
|
|
1295
|
+
setDisplayLengthInputField = _useState[1];
|
|
1185
1296
|
React.useEffect(function () {
|
|
1186
1297
|
if (!open && displayLengthInputField) {
|
|
1187
|
-
|
|
1298
|
+
setDisplayLengthInputField(false);
|
|
1188
1299
|
}
|
|
1189
1300
|
}, [displayLengthInputField, open]);
|
|
1190
1301
|
var buttonText = function buttonText(value, displayCurrentLength, currentMark) {
|
|
@@ -1214,18 +1325,18 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1214
1325
|
event.stopPropagation();
|
|
1215
1326
|
},
|
|
1216
1327
|
children: [jsxs(CustomIconButton, {
|
|
1217
|
-
|
|
1218
|
-
tooltipTitle: title,
|
|
1328
|
+
isSelected: true,
|
|
1219
1329
|
onClick: function onClick() {
|
|
1220
1330
|
setOpen(true);
|
|
1221
1331
|
},
|
|
1222
|
-
ref: setAnchorRef,
|
|
1223
|
-
isSelected: true,
|
|
1224
1332
|
onWheel: onWheel,
|
|
1333
|
+
ref: setAnchorRef,
|
|
1225
1334
|
sx: {
|
|
1226
1335
|
padding: '11px!important',
|
|
1227
1336
|
width: '100%!important'
|
|
1228
1337
|
},
|
|
1338
|
+
tooltipTitle: title,
|
|
1339
|
+
variant: "tool",
|
|
1229
1340
|
children: [icon, jsx(Typography, {
|
|
1230
1341
|
sx: {
|
|
1231
1342
|
fontSize: 12,
|
|
@@ -1234,12 +1345,16 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1234
1345
|
},
|
|
1235
1346
|
children: buttonText(value, displayCurrentLength, currentMark)
|
|
1236
1347
|
})]
|
|
1237
|
-
}), anchorRef && jsxs(Menu, {
|
|
1348
|
+
}), !!anchorRef && jsxs(Menu, {
|
|
1238
1349
|
anchorEl: anchorRef,
|
|
1239
|
-
|
|
1350
|
+
anchorOrigin: {
|
|
1351
|
+
vertical: -15,
|
|
1352
|
+
horizontal: 'center'
|
|
1353
|
+
},
|
|
1240
1354
|
onClose: function onClose() {
|
|
1241
1355
|
return setOpen(false);
|
|
1242
1356
|
},
|
|
1357
|
+
open: open,
|
|
1243
1358
|
slotProps: {
|
|
1244
1359
|
backdrop: {
|
|
1245
1360
|
sx: {
|
|
@@ -1247,10 +1362,6 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1247
1362
|
}
|
|
1248
1363
|
}
|
|
1249
1364
|
},
|
|
1250
|
-
anchorOrigin: {
|
|
1251
|
-
vertical: -15,
|
|
1252
|
-
horizontal: 'center'
|
|
1253
|
-
},
|
|
1254
1365
|
transformOrigin: {
|
|
1255
1366
|
vertical: 'bottom',
|
|
1256
1367
|
horizontal: 'center'
|
|
@@ -1270,50 +1381,50 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1270
1381
|
}), marks.map(function (mark) {
|
|
1271
1382
|
var isSelected = (currentMark == null ? void 0 : currentMark.value) === mark.value && !isAutoSelected;
|
|
1272
1383
|
return jsx(MenuItem, {
|
|
1384
|
+
disabled: allOptionsDisabled,
|
|
1273
1385
|
onClick: function onClick() {
|
|
1274
1386
|
if (!isSelected) {
|
|
1275
1387
|
onChangeSliderValue(mark.value);
|
|
1276
1388
|
}
|
|
1277
1389
|
setOpen(false);
|
|
1278
1390
|
},
|
|
1279
|
-
selected: isSelected && !displayLengthInputField,
|
|
1280
|
-
disabled: allOptionsDisabled,
|
|
1391
|
+
selected: !!isSelected && !displayLengthInputField,
|
|
1281
1392
|
children: mark.label || mark.text
|
|
1282
1393
|
}, mark.value);
|
|
1283
|
-
}), handleAutoClick && jsx(MenuItem, {
|
|
1394
|
+
}), !!handleAutoClick && jsx(MenuItem, {
|
|
1395
|
+
disabled: allOptionsDisabled || isAutoDisabled,
|
|
1284
1396
|
onClick: function onClick() {
|
|
1285
1397
|
handleAutoClick();
|
|
1286
1398
|
setOpen(false);
|
|
1287
1399
|
},
|
|
1288
1400
|
selected: isAutoSelected,
|
|
1289
|
-
disabled: allOptionsDisabled || isAutoDisabled,
|
|
1290
1401
|
children: t('timeslider-auto')
|
|
1291
|
-
}), displayCurrentLength && jsxs(MenuItem, {
|
|
1402
|
+
}), !!displayCurrentLength && jsxs(MenuItem, {
|
|
1403
|
+
disabled: disbleUserSetDuration,
|
|
1292
1404
|
onClick: function onClick() {
|
|
1293
|
-
return
|
|
1405
|
+
return setDisplayLengthInputField(true);
|
|
1294
1406
|
},
|
|
1295
|
-
disabled: disbleUserSetDuration,
|
|
1296
1407
|
sx: {
|
|
1297
1408
|
maxWidth: '175px'
|
|
1298
1409
|
},
|
|
1299
|
-
children: [displayLengthInputField && customLengthSelector, !displayLengthInputField && jsxs(Box, {
|
|
1410
|
+
children: [!!displayLengthInputField && customLengthSelector, !displayLengthInputField && jsxs(Box, {
|
|
1300
1411
|
sx: {
|
|
1301
1412
|
flexDirection: 'column',
|
|
1302
1413
|
display: 'flex',
|
|
1303
1414
|
flexGrow: 1
|
|
1304
1415
|
},
|
|
1305
1416
|
children: [jsx(CardHeader, {
|
|
1306
|
-
|
|
1417
|
+
slotProps: {
|
|
1418
|
+
title: {
|
|
1419
|
+
fontSize: 12
|
|
1420
|
+
}
|
|
1421
|
+
},
|
|
1307
1422
|
sx: {
|
|
1308
1423
|
height: 2,
|
|
1309
1424
|
padding: 0,
|
|
1310
1425
|
color: 'geowebColors.greys.accessible'
|
|
1311
1426
|
},
|
|
1312
|
-
|
|
1313
|
-
title: {
|
|
1314
|
-
fontSize: 12
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1427
|
+
title: t(customFieldHeader)
|
|
1317
1428
|
}), jsxs(Box, {
|
|
1318
1429
|
sx: {
|
|
1319
1430
|
flexDirection: 'row',
|
|
@@ -1346,137 +1457,51 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1346
1457
|
});
|
|
1347
1458
|
};
|
|
1348
1459
|
|
|
1349
|
-
var SpeedButton = function SpeedButton(_ref) {
|
|
1350
|
-
var animationDelay = _ref.animationDelay,
|
|
1351
|
-
setMapAnimationDelay = _ref.setMapAnimationDelay;
|
|
1352
|
-
var sorted = [].concat(speedFactors).sort(function (sa, sb) {
|
|
1353
|
-
return sb - sa;
|
|
1354
|
-
});
|
|
1355
|
-
var marks = sorted.map(function (speedFactor) {
|
|
1356
|
-
return {
|
|
1357
|
-
value: getSpeedDelay(speedFactor),
|
|
1358
|
-
text: "x" + speedFactor,
|
|
1359
|
-
label: "x" + speedFactor
|
|
1360
|
-
};
|
|
1361
|
-
});
|
|
1362
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1363
|
-
t = _useTimesliderTransla.t;
|
|
1364
|
-
var _useState = useState(false),
|
|
1365
|
-
open = _useState[0],
|
|
1366
|
-
setOpen = _useState[1];
|
|
1367
|
-
return jsx(TimeSliderMenu, {
|
|
1368
|
-
onChangeSliderValue: function onChangeSliderValue(markValue) {
|
|
1369
|
-
setMapAnimationDelay(markValue);
|
|
1370
|
-
},
|
|
1371
|
-
icon: jsx(Speed, {}),
|
|
1372
|
-
marks: marks,
|
|
1373
|
-
title: t('timeslider-speed'),
|
|
1374
|
-
value: animationDelay,
|
|
1375
|
-
open: open,
|
|
1376
|
-
setOpen: setOpen
|
|
1377
|
-
});
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
1460
|
var marks$2 = [{
|
|
1381
|
-
value:
|
|
1382
|
-
text: 'timeslider-min',
|
|
1383
|
-
count: 1
|
|
1384
|
-
}, {
|
|
1385
|
-
value: 2,
|
|
1386
|
-
text: 'timeslider-min',
|
|
1387
|
-
count: 2
|
|
1388
|
-
}, {
|
|
1389
|
-
value: 5,
|
|
1390
|
-
text: 'timeslider-min',
|
|
1391
|
-
count: 5
|
|
1392
|
-
}, {
|
|
1393
|
-
value: 10,
|
|
1394
|
-
text: 'timeslider-min',
|
|
1395
|
-
count: 10
|
|
1396
|
-
}, {
|
|
1397
|
-
value: 15,
|
|
1461
|
+
value: AnimationLength.Minutes15,
|
|
1398
1462
|
text: 'timeslider-min',
|
|
1399
1463
|
count: 15
|
|
1400
1464
|
}, {
|
|
1401
|
-
value:
|
|
1465
|
+
value: AnimationLength.Minutes30,
|
|
1402
1466
|
text: 'timeslider-min',
|
|
1403
1467
|
count: 30
|
|
1404
1468
|
}, {
|
|
1405
|
-
value:
|
|
1469
|
+
value: AnimationLength.Hours1,
|
|
1406
1470
|
text: 'timeslider-hour',
|
|
1407
1471
|
count: 1
|
|
1408
1472
|
}, {
|
|
1409
|
-
value:
|
|
1473
|
+
value: AnimationLength.Hours2,
|
|
1410
1474
|
text: 'timeslider-hour',
|
|
1411
1475
|
count: 2
|
|
1412
1476
|
}, {
|
|
1413
|
-
value:
|
|
1477
|
+
value: AnimationLength.Hours3,
|
|
1414
1478
|
text: 'timeslider-hour',
|
|
1415
1479
|
count: 3
|
|
1416
1480
|
}, {
|
|
1417
|
-
value:
|
|
1481
|
+
value: AnimationLength.Hours6,
|
|
1418
1482
|
text: 'timeslider-hour',
|
|
1419
1483
|
count: 6
|
|
1420
1484
|
}, {
|
|
1421
|
-
value:
|
|
1485
|
+
value: AnimationLength.Hours12,
|
|
1422
1486
|
text: 'timeslider-hour',
|
|
1423
1487
|
count: 12
|
|
1424
1488
|
}, {
|
|
1425
|
-
value:
|
|
1489
|
+
value: AnimationLength.Hours24,
|
|
1426
1490
|
text: 'timeslider-hour',
|
|
1427
1491
|
count: 24
|
|
1428
|
-
}, {
|
|
1429
|
-
value: 2880,
|
|
1430
|
-
text: 'timeslider-hour',
|
|
1431
|
-
count: 48
|
|
1432
|
-
}, {
|
|
1433
|
-
value: 4320,
|
|
1434
|
-
text: 'timeslider-hour',
|
|
1435
|
-
count: 72
|
|
1436
|
-
}, {
|
|
1437
|
-
value: 10080,
|
|
1438
|
-
text: 'timeslider-week',
|
|
1439
|
-
count: 1
|
|
1440
|
-
}, {
|
|
1441
|
-
value: 20160,
|
|
1442
|
-
text: 'timeslider-weeks',
|
|
1443
|
-
count: 2
|
|
1444
|
-
}, {
|
|
1445
|
-
value: 43200,
|
|
1446
|
-
text: 'timeslider-month',
|
|
1447
|
-
count: 1
|
|
1448
|
-
}, {
|
|
1449
|
-
value: 87600,
|
|
1450
|
-
text: 'timeslider-months',
|
|
1451
|
-
count: 2
|
|
1452
|
-
}, {
|
|
1453
|
-
value: 262800,
|
|
1454
|
-
text: 'timeslider-months',
|
|
1455
|
-
count: 6
|
|
1456
|
-
}, {
|
|
1457
|
-
value: 525600,
|
|
1458
|
-
text: 'timeslider-year',
|
|
1459
|
-
count: 1
|
|
1460
|
-
}, {
|
|
1461
|
-
value: 5256000,
|
|
1462
|
-
text: 'timeslider-years',
|
|
1463
|
-
count: 10
|
|
1464
1492
|
}].sort(function (ta, tb) {
|
|
1465
1493
|
return tb.value - ta.value;
|
|
1466
1494
|
});
|
|
1467
|
-
var
|
|
1468
|
-
var _ref$
|
|
1469
|
-
timeStep = _ref$timeStep === void 0 ? marks$2[0].value : _ref$timeStep,
|
|
1470
|
-
_ref$disabled = _ref.disabled,
|
|
1495
|
+
var AnimationLengthButton = function AnimationLengthButton(_ref) {
|
|
1496
|
+
var _ref$disabled = _ref.disabled,
|
|
1471
1497
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1472
|
-
_ref$
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
_ref$
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
timeStepFromLayer = _ref.timeStepFromLayer;
|
|
1498
|
+
_ref$animationLength = _ref.animationLength,
|
|
1499
|
+
animationLength = _ref$animationLength === void 0 ? AnimationLength.Hours1 : _ref$animationLength,
|
|
1500
|
+
_ref$isAuto = _ref.isAuto,
|
|
1501
|
+
isAuto = _ref$isAuto === void 0 ? false : _ref$isAuto,
|
|
1502
|
+
layerHasTimeStep = _ref.layerHasTimeStep,
|
|
1503
|
+
onChangeAnimationLength = _ref.onChangeAnimationLength,
|
|
1504
|
+
toggleAnimationLengthAuto = _ref.toggleAnimationLengthAuto;
|
|
1480
1505
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1481
1506
|
t = _useTimesliderTransla.t;
|
|
1482
1507
|
var translatedMarks = marks$2.map(function (mark) {
|
|
@@ -1484,39 +1509,59 @@ var TimeStepButton = function TimeStepButton(_ref) {
|
|
|
1484
1509
|
label: mark.count + " " + t(mark.text)
|
|
1485
1510
|
});
|
|
1486
1511
|
});
|
|
1487
|
-
var
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
onChangeTimeStep(markValue);
|
|
1492
|
-
};
|
|
1493
|
-
var handleToggleTimeStep = function handleToggleTimeStep() {
|
|
1494
|
-
if (isTimestepAuto) {
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
onToggleTimestepAuto();
|
|
1498
|
-
timeStepFromLayer && onChangeTimeStep(timeStepFromLayer);
|
|
1512
|
+
var onChangeSliderValue = function onChangeSliderValue(newSliderValue) {
|
|
1513
|
+
var newLength = newSliderValue ? Math.round(newSliderValue) : 0;
|
|
1514
|
+
onChangeAnimationLength == null || onChangeAnimationLength(newLength);
|
|
1499
1515
|
};
|
|
1500
|
-
var
|
|
1501
|
-
renderCounter.count(TimeStepButton.name);
|
|
1502
|
-
var _useState = useState(isOpenByDefault),
|
|
1516
|
+
var _useState = useState(false),
|
|
1503
1517
|
open = _useState[0],
|
|
1504
1518
|
setOpen = _useState[1];
|
|
1505
1519
|
return jsx(TimeSliderMenu, {
|
|
1506
|
-
title: t('timeslider-time-step'),
|
|
1507
|
-
marks: translatedMarks,
|
|
1508
|
-
value: timeStep || translatedMarks[0].value,
|
|
1509
|
-
onChangeSliderValue: onMenuItemClick,
|
|
1510
1520
|
allOptionsDisabled: disabled,
|
|
1511
|
-
isAutoSelected: isTimestepAuto,
|
|
1512
|
-
isAutoDisabled: !layerHasTimeStep,
|
|
1513
|
-
handleAutoClick: handleToggleTimeStep,
|
|
1514
|
-
icon: jsx(FastForward, {
|
|
1515
|
-
"data-testid": "timeStepButton"
|
|
1516
|
-
}),
|
|
1517
1521
|
displayCurrentLength: true,
|
|
1522
|
+
handleAutoClick: toggleAnimationLengthAuto,
|
|
1523
|
+
icon: jsx(Animation, {
|
|
1524
|
+
"data-testid": "animationLengthButton"
|
|
1525
|
+
}),
|
|
1526
|
+
isAutoDisabled: !layerHasTimeStep,
|
|
1527
|
+
isAutoSelected: isAuto,
|
|
1528
|
+
marks: translatedMarks,
|
|
1529
|
+
onChangeSliderValue: onChangeSliderValue,
|
|
1530
|
+
open: open,
|
|
1531
|
+
setOpen: setOpen,
|
|
1532
|
+
title: t('timeslider-animation'),
|
|
1533
|
+
value: animationLength
|
|
1534
|
+
});
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
var SpeedButton = function SpeedButton(_ref) {
|
|
1538
|
+
var animationDelay = _ref.animationDelay,
|
|
1539
|
+
setMapAnimationDelay = _ref.setMapAnimationDelay;
|
|
1540
|
+
var sorted = [].concat(speedFactors).sort(function (sa, sb) {
|
|
1541
|
+
return sb - sa;
|
|
1542
|
+
});
|
|
1543
|
+
var marks = sorted.map(function (speedFactor) {
|
|
1544
|
+
return {
|
|
1545
|
+
value: getSpeedDelay(speedFactor),
|
|
1546
|
+
text: "x" + speedFactor,
|
|
1547
|
+
label: "x" + speedFactor
|
|
1548
|
+
};
|
|
1549
|
+
});
|
|
1550
|
+
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1551
|
+
t = _useTimesliderTransla.t;
|
|
1552
|
+
var _useState = useState(false),
|
|
1553
|
+
open = _useState[0],
|
|
1554
|
+
setOpen = _useState[1];
|
|
1555
|
+
return jsx(TimeSliderMenu, {
|
|
1556
|
+
icon: jsx(Speed, {}),
|
|
1557
|
+
marks: marks,
|
|
1558
|
+
onChangeSliderValue: function onChangeSliderValue(markValue) {
|
|
1559
|
+
setMapAnimationDelay(markValue);
|
|
1560
|
+
},
|
|
1518
1561
|
open: open,
|
|
1519
|
-
setOpen: setOpen
|
|
1562
|
+
setOpen: setOpen,
|
|
1563
|
+
title: t('timeslider-speed'),
|
|
1564
|
+
value: animationDelay
|
|
1520
1565
|
});
|
|
1521
1566
|
};
|
|
1522
1567
|
|
|
@@ -1526,71 +1571,71 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
1526
1571
|
onChangeSliderValue = _ref.onChangeSliderValue;
|
|
1527
1572
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1528
1573
|
t = _useTimesliderTransla.t;
|
|
1529
|
-
var _React$useState =
|
|
1574
|
+
var _React$useState = React.useState(timeSliderSpan / getLargestTimeUnit(timeSliderSpan)),
|
|
1530
1575
|
selectedTimeValue = _React$useState[0],
|
|
1531
1576
|
setSelectedTimeValue = _React$useState[1];
|
|
1532
|
-
var _React$useState2 =
|
|
1577
|
+
var _React$useState2 = React.useState(getLargestTimeUnit(timeSliderSpan).toString()),
|
|
1533
1578
|
selectedTimeResolution = _React$useState2[0],
|
|
1534
1579
|
setSelectedTimeResolution = _React$useState2[1];
|
|
1535
|
-
var _React$useState3 =
|
|
1580
|
+
var _React$useState3 = React.useState(true),
|
|
1536
1581
|
isANumber = _React$useState3[0],
|
|
1537
|
-
|
|
1582
|
+
setIsANumber = _React$useState3[1];
|
|
1538
1583
|
return jsx(Box, {
|
|
1539
1584
|
children: jsxs(FormControl, {
|
|
1540
|
-
|
|
1585
|
+
onKeyDown: function onKeyDown(event) {
|
|
1586
|
+
event.stopPropagation();
|
|
1587
|
+
},
|
|
1541
1588
|
size: "small",
|
|
1542
1589
|
sx: {
|
|
1543
1590
|
flexDirection: 'row',
|
|
1544
1591
|
display: 'flex'
|
|
1545
1592
|
},
|
|
1546
|
-
|
|
1547
|
-
event.stopPropagation();
|
|
1548
|
-
},
|
|
1593
|
+
variant: "standard",
|
|
1549
1594
|
children: [jsx(TextField, {
|
|
1550
|
-
label: t('timeslider-span'),
|
|
1551
|
-
size: "small",
|
|
1552
|
-
variant: "standard",
|
|
1553
|
-
value: Math.round(selectedTimeValue * 100) / 100,
|
|
1554
1595
|
autoFocus: true,
|
|
1596
|
+
color: isANumber ? 'primary' : 'warning',
|
|
1597
|
+
label: t('timeslider-span'),
|
|
1598
|
+
onBlur: function onBlur() {
|
|
1599
|
+
onChangeSliderValue(selectedTimeValue * Number(selectedTimeResolution));
|
|
1600
|
+
},
|
|
1555
1601
|
onChange: function onChange(e) {
|
|
1556
1602
|
if (!isNaN(+e.target.value)) {
|
|
1557
|
-
|
|
1603
|
+
setIsANumber(true);
|
|
1558
1604
|
setSelectedTimeValue(Number(e.target.value));
|
|
1559
1605
|
} else {
|
|
1560
|
-
|
|
1606
|
+
setIsANumber(false);
|
|
1561
1607
|
}
|
|
1562
1608
|
},
|
|
1563
|
-
color: isANumber ? 'primary' : 'warning',
|
|
1564
|
-
onBlur: function onBlur() {
|
|
1565
|
-
onChangeSliderValue(selectedTimeValue * Number(selectedTimeResolution));
|
|
1566
|
-
},
|
|
1567
1609
|
onKeyDown: function onKeyDown(e) {
|
|
1568
1610
|
if (e.key === 'Enter' || e.key === 'Escape') {
|
|
1569
1611
|
onChangeSliderValue(selectedTimeValue * Number(selectedTimeResolution));
|
|
1570
1612
|
setOpen(false);
|
|
1571
1613
|
}
|
|
1572
1614
|
},
|
|
1615
|
+
size: "small",
|
|
1573
1616
|
slotProps: {
|
|
1574
1617
|
htmlInput: {
|
|
1575
1618
|
maxLength: 4,
|
|
1576
1619
|
'aria-label': 'custom-input'
|
|
1577
1620
|
}
|
|
1578
|
-
}
|
|
1621
|
+
},
|
|
1622
|
+
value: Math.round(selectedTimeValue * 100) / 100,
|
|
1623
|
+
variant: "standard"
|
|
1579
1624
|
}), jsx(Box, {
|
|
1580
1625
|
sx: {
|
|
1581
1626
|
alignContent: 'end'
|
|
1582
1627
|
},
|
|
1583
1628
|
children: jsxs(Select, {
|
|
1584
|
-
|
|
1629
|
+
"aria-label": "time-resolution-selector",
|
|
1585
1630
|
defaultValue: "h",
|
|
1586
1631
|
onChange: function onChange(e) {
|
|
1587
1632
|
setSelectedTimeResolution(e.target.value);
|
|
1588
1633
|
onChangeSliderValue(selectedTimeValue * Number(e.target.value));
|
|
1589
1634
|
setOpen(false);
|
|
1590
1635
|
},
|
|
1591
|
-
"aria-label": "time-resolution-selector",
|
|
1592
1636
|
size: "small",
|
|
1593
1637
|
tabIndex: -1,
|
|
1638
|
+
value: selectedTimeResolution,
|
|
1594
1639
|
children: [jsx(MenuItem, {
|
|
1595
1640
|
value: TimeInMinutes.YEAR,
|
|
1596
1641
|
children: t('years')
|
|
@@ -1687,269 +1732,213 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
1687
1732
|
open = _useState[0],
|
|
1688
1733
|
setOpen = _useState[1];
|
|
1689
1734
|
return jsx(TimeSliderMenu, {
|
|
1735
|
+
allOptionsDisabled: disabled,
|
|
1736
|
+
customFieldHeader: t('timeslider-span'),
|
|
1737
|
+
customLengthSelector: jsx(TimeSpanButtonCustomSelect, {
|
|
1738
|
+
onChangeSliderValue: onChangeSliderValue,
|
|
1739
|
+
setOpen: setOpen,
|
|
1740
|
+
timeSliderSpan: timeSliderSpan
|
|
1741
|
+
}),
|
|
1742
|
+
disbleUserSetDuration: false,
|
|
1743
|
+
displayCurrentLength: true,
|
|
1744
|
+
handleAutoClick: onToggleTimeSpan,
|
|
1690
1745
|
icon: jsx(Clock, {}),
|
|
1746
|
+
isAutoDisabled: !layerHasTimeStep,
|
|
1747
|
+
isAutoSelected: isTimeSpanAuto,
|
|
1691
1748
|
marks: translatedMarks,
|
|
1692
|
-
displayCurrentLength: true,
|
|
1693
|
-
title: t('timeslider-time-span'),
|
|
1694
|
-
customFieldHeader: t('timeslider-span'),
|
|
1695
|
-
value: timeSliderSpan,
|
|
1696
1749
|
onChangeSliderValue: onChangeSliderValue,
|
|
1697
|
-
allOptionsDisabled: disabled,
|
|
1698
|
-
isAutoSelected: isTimeSpanAuto,
|
|
1699
|
-
isAutoDisabled: !layerHasTimeStep,
|
|
1700
|
-
handleAutoClick: onToggleTimeSpan,
|
|
1701
|
-
disbleUserSetDuration: false,
|
|
1702
1750
|
open: open,
|
|
1703
1751
|
setOpen: setOpen,
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
setOpen: setOpen,
|
|
1707
|
-
onChangeSliderValue: onChangeSliderValue
|
|
1708
|
-
})
|
|
1752
|
+
title: t('timeslider-time-span'),
|
|
1753
|
+
value: timeSliderSpan
|
|
1709
1754
|
});
|
|
1710
1755
|
};
|
|
1711
1756
|
|
|
1712
1757
|
var marks = [{
|
|
1713
|
-
value:
|
|
1758
|
+
value: 1,
|
|
1759
|
+
text: 'timeslider-min',
|
|
1760
|
+
count: 1
|
|
1761
|
+
}, {
|
|
1762
|
+
value: 2,
|
|
1763
|
+
text: 'timeslider-min',
|
|
1764
|
+
count: 2
|
|
1765
|
+
}, {
|
|
1766
|
+
value: 5,
|
|
1767
|
+
text: 'timeslider-min',
|
|
1768
|
+
count: 5
|
|
1769
|
+
}, {
|
|
1770
|
+
value: 10,
|
|
1771
|
+
text: 'timeslider-min',
|
|
1772
|
+
count: 10
|
|
1773
|
+
}, {
|
|
1774
|
+
value: 15,
|
|
1714
1775
|
text: 'timeslider-min',
|
|
1715
1776
|
count: 15
|
|
1716
1777
|
}, {
|
|
1717
|
-
value:
|
|
1778
|
+
value: 30,
|
|
1718
1779
|
text: 'timeslider-min',
|
|
1719
1780
|
count: 30
|
|
1720
1781
|
}, {
|
|
1721
|
-
value:
|
|
1782
|
+
value: 60,
|
|
1722
1783
|
text: 'timeslider-hour',
|
|
1723
1784
|
count: 1
|
|
1724
1785
|
}, {
|
|
1725
|
-
value:
|
|
1786
|
+
value: 120,
|
|
1726
1787
|
text: 'timeslider-hour',
|
|
1727
1788
|
count: 2
|
|
1728
1789
|
}, {
|
|
1729
|
-
value:
|
|
1790
|
+
value: 180,
|
|
1730
1791
|
text: 'timeslider-hour',
|
|
1731
1792
|
count: 3
|
|
1732
1793
|
}, {
|
|
1733
|
-
value:
|
|
1794
|
+
value: 360,
|
|
1734
1795
|
text: 'timeslider-hour',
|
|
1735
1796
|
count: 6
|
|
1736
1797
|
}, {
|
|
1737
|
-
value:
|
|
1798
|
+
value: 720,
|
|
1738
1799
|
text: 'timeslider-hour',
|
|
1739
1800
|
count: 12
|
|
1740
1801
|
}, {
|
|
1741
|
-
value:
|
|
1802
|
+
value: 1440,
|
|
1742
1803
|
text: 'timeslider-hour',
|
|
1743
1804
|
count: 24
|
|
1805
|
+
}, {
|
|
1806
|
+
value: 2880,
|
|
1807
|
+
text: 'timeslider-hour',
|
|
1808
|
+
count: 48
|
|
1809
|
+
}, {
|
|
1810
|
+
value: 4320,
|
|
1811
|
+
text: 'timeslider-hour',
|
|
1812
|
+
count: 72
|
|
1813
|
+
}, {
|
|
1814
|
+
value: 10080,
|
|
1815
|
+
text: 'timeslider-week',
|
|
1816
|
+
count: 1
|
|
1817
|
+
}, {
|
|
1818
|
+
value: 20160,
|
|
1819
|
+
text: 'timeslider-weeks',
|
|
1820
|
+
count: 2
|
|
1821
|
+
}, {
|
|
1822
|
+
value: 43200,
|
|
1823
|
+
text: 'timeslider-month',
|
|
1824
|
+
count: 1
|
|
1825
|
+
}, {
|
|
1826
|
+
value: 87600,
|
|
1827
|
+
text: 'timeslider-months',
|
|
1828
|
+
count: 2
|
|
1829
|
+
}, {
|
|
1830
|
+
value: 262800,
|
|
1831
|
+
text: 'timeslider-months',
|
|
1832
|
+
count: 6
|
|
1833
|
+
}, {
|
|
1834
|
+
value: 525600,
|
|
1835
|
+
text: 'timeslider-year',
|
|
1836
|
+
count: 1
|
|
1837
|
+
}, {
|
|
1838
|
+
value: 5256000,
|
|
1839
|
+
text: 'timeslider-years',
|
|
1840
|
+
count: 10
|
|
1744
1841
|
}].sort(function (ta, tb) {
|
|
1745
1842
|
return tb.value - ta.value;
|
|
1746
1843
|
});
|
|
1747
|
-
var
|
|
1748
|
-
var _ref$
|
|
1844
|
+
var TimeStepButton = function TimeStepButton(_ref) {
|
|
1845
|
+
var _ref$timeStep = _ref.timeStep,
|
|
1846
|
+
timeStep = _ref$timeStep === void 0 ? marks[0].value : _ref$timeStep,
|
|
1847
|
+
_ref$disabled = _ref.disabled,
|
|
1749
1848
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1750
|
-
_ref$
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1849
|
+
_ref$isTimestepAuto = _ref.isTimestepAuto,
|
|
1850
|
+
isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto,
|
|
1851
|
+
onChangeTimeStep = _ref.onChangeTimeStep,
|
|
1852
|
+
_ref$onToggleTimestep = _ref.onToggleTimestepAuto,
|
|
1853
|
+
onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
|
|
1854
|
+
_ref$isOpenByDefault = _ref.isOpenByDefault,
|
|
1855
|
+
isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault,
|
|
1856
|
+
timeStepFromLayer = _ref.timeStepFromLayer;
|
|
1757
1857
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1758
1858
|
t = _useTimesliderTransla.t;
|
|
1759
1859
|
var translatedMarks = marks.map(function (mark) {
|
|
1760
1860
|
return Object.assign({}, mark, {
|
|
1761
1861
|
label: mark.count + " " + t(mark.text)
|
|
1762
|
-
});
|
|
1763
|
-
});
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
xs: 'auto'
|
|
1798
|
-
},
|
|
1799
|
-
children: timeSpanBtn || jsx(TimeSpanButton, {
|
|
1800
|
-
onChangeSliderValue: function onChangeSliderValue() {},
|
|
1801
|
-
onToggleTimeSpan: function onToggleTimeSpan() {},
|
|
1802
|
-
isTimeSpanAuto: false,
|
|
1803
|
-
layerHasTimeStep: false,
|
|
1804
|
-
timeSliderSpan: 0,
|
|
1805
|
-
disabled: false
|
|
1806
|
-
})
|
|
1807
|
-
}), jsx(Grid, {
|
|
1808
|
-
size: {
|
|
1809
|
-
xs: 'auto'
|
|
1810
|
-
},
|
|
1811
|
-
children: animationLengthBtn || jsx(AnimationLengthButton, {
|
|
1812
|
-
toggleAnimationLengthAuto: function toggleAnimationLengthAuto() {},
|
|
1813
|
-
onChangeAnimationLength: function onChangeAnimationLength() {}
|
|
1814
|
-
})
|
|
1815
|
-
}), jsx(Grid, {
|
|
1816
|
-
size: {
|
|
1817
|
-
xs: 'auto'
|
|
1818
|
-
},
|
|
1819
|
-
children: timeStepBtn || jsx(TimeStepButton, {
|
|
1820
|
-
onChangeTimeStep: function onChangeTimeStep() {},
|
|
1821
|
-
isTimestepAuto: false
|
|
1822
|
-
})
|
|
1823
|
-
}), jsx(Grid, {
|
|
1824
|
-
size: {
|
|
1825
|
-
xs: 'auto'
|
|
1826
|
-
},
|
|
1827
|
-
children: speedBtn || jsx(SpeedButton, {
|
|
1828
|
-
animationDelay: defaultAnimationDelayAtStart,
|
|
1829
|
-
setMapAnimationDelay: function setMapAnimationDelay() {}
|
|
1830
|
-
})
|
|
1831
|
-
})]
|
|
1832
|
-
});
|
|
1833
|
-
};
|
|
1834
|
-
|
|
1835
|
-
var PlayButton = function PlayButton(_ref) {
|
|
1836
|
-
var isAnimating = _ref.isAnimating,
|
|
1837
|
-
isDisabled = _ref.isDisabled,
|
|
1838
|
-
_ref$onTogglePlayButt = _ref.onTogglePlayButton,
|
|
1839
|
-
onTogglePlayButton = _ref$onTogglePlayButt === void 0 ? function () {} : _ref$onTogglePlayButt;
|
|
1840
|
-
var onTogglePlay = function onTogglePlay() {
|
|
1841
|
-
onTogglePlayButton();
|
|
1842
|
-
};
|
|
1843
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1844
|
-
t = _useTimesliderTransla.t;
|
|
1845
|
-
return jsx(CustomIconButton, {
|
|
1846
|
-
variant: "tool",
|
|
1847
|
-
tooltipTitle: isAnimating ? t('timeslider-pause') : t('timeslider-play'),
|
|
1848
|
-
onClick: onTogglePlay,
|
|
1849
|
-
disabled: isDisabled,
|
|
1850
|
-
"data-testid": "playButton",
|
|
1851
|
-
isSelected: isAnimating,
|
|
1852
|
-
children: isAnimating ? jsx(Pause, {
|
|
1853
|
-
"data-testid": "pause-svg-path"
|
|
1854
|
-
}) : jsx(Play, {
|
|
1855
|
-
"data-testid": "play-svg-path"
|
|
1856
|
-
})
|
|
1857
|
-
});
|
|
1858
|
-
};
|
|
1859
|
-
|
|
1860
|
-
var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
1861
|
-
var isForwardStep = _ref.isForwardStep,
|
|
1862
|
-
isDisabled = _ref.isDisabled,
|
|
1863
|
-
_ref$onClickBFButton = _ref.onClickBFButton,
|
|
1864
|
-
onClickBFButton = _ref$onClickBFButton === void 0 ? function () {} : _ref$onClickBFButton;
|
|
1865
|
-
// Added renderCounter for testing and performance purposes
|
|
1866
|
-
renderCounter.count(BackwardForwardStepButton.name);
|
|
1867
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1868
|
-
t = _useTimesliderTransla.t;
|
|
1869
|
-
return jsx(CustomIconButton, {
|
|
1870
|
-
variant: "tool",
|
|
1871
|
-
"data-testid": isForwardStep ? 'stepForwardButton' : 'stepBackwardButton',
|
|
1872
|
-
disabled: isDisabled,
|
|
1873
|
-
"aria-label": isForwardStep ? 'forward' : 'backward',
|
|
1874
|
-
onClick: onClickBFButton,
|
|
1875
|
-
tooltipTitle: isForwardStep ? t('timeslider-forward') : t('timeslider-backward'),
|
|
1876
|
-
children: isForwardStep ? jsx(StepForward, {
|
|
1877
|
-
"data-testid": "step-forward-svg-path"
|
|
1878
|
-
}) : jsx(StepBackward, {
|
|
1879
|
-
"data-testid": "step-backward-svg-path"
|
|
1880
|
-
})
|
|
1881
|
-
});
|
|
1882
|
-
};
|
|
1883
|
-
|
|
1884
|
-
var NowButton = function NowButton(_ref) {
|
|
1885
|
-
var _ref$onSetNow = _ref.onSetNow,
|
|
1886
|
-
onSetNow = _ref$onSetNow === void 0 ? function () {} : _ref$onSetNow,
|
|
1887
|
-
_ref$disabled = _ref.disabled,
|
|
1888
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
1889
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1890
|
-
t = _useTimesliderTransla.t;
|
|
1891
|
-
return jsx(CustomIconButton, {
|
|
1892
|
-
variant: "tool",
|
|
1893
|
-
"aria-label": "now",
|
|
1894
|
-
tooltipTitle: t('timeslider-now'),
|
|
1895
|
-
"data-testid": "nowButtonTooltip",
|
|
1896
|
-
disabled: disabled,
|
|
1897
|
-
onClick: function onClick() {
|
|
1898
|
-
return onSetNow();
|
|
1899
|
-
},
|
|
1900
|
-
children: jsx(Now, {
|
|
1901
|
-
"data-testid": "now-svg"
|
|
1902
|
-
})
|
|
1903
|
-
});
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
|
-
var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
1907
|
-
var _ref$toggleAutoUpdate = _ref.toggleAutoUpdate,
|
|
1908
|
-
toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {} : _ref$toggleAutoUpdate,
|
|
1909
|
-
_ref$isAutoUpdating = _ref.isAutoUpdating,
|
|
1910
|
-
isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
|
|
1911
|
-
_ref$disabled = _ref.disabled,
|
|
1912
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
1913
|
-
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
1914
|
-
t = _useTimesliderTransla.t;
|
|
1915
|
-
return jsx(CustomIconButton, {
|
|
1916
|
-
variant: "tool",
|
|
1917
|
-
isSelected: isAutoUpdating,
|
|
1918
|
-
disabled: disabled,
|
|
1919
|
-
onClick: function onClick() {
|
|
1920
|
-
return toggleAutoUpdate();
|
|
1921
|
-
},
|
|
1922
|
-
"data-testid": "autoUpdateButton",
|
|
1923
|
-
tooltipTitle: isAutoUpdating ? t('timeslider-auto-update-on') : t('timeslider-auto-update-off'),
|
|
1924
|
-
children: isAutoUpdating ? jsx(AutoUpdateActive, {
|
|
1925
|
-
"data-testid": "auto-update-svg-on"
|
|
1926
|
-
}) : jsx(AutoUpdateInActive, {
|
|
1927
|
-
"data-testid": "auto-update-svg-off"
|
|
1928
|
-
})
|
|
1862
|
+
});
|
|
1863
|
+
});
|
|
1864
|
+
var onMenuItemClick = function onMenuItemClick(markValue) {
|
|
1865
|
+
if (isTimestepAuto) {
|
|
1866
|
+
onToggleTimestepAuto();
|
|
1867
|
+
}
|
|
1868
|
+
onChangeTimeStep(markValue);
|
|
1869
|
+
};
|
|
1870
|
+
var handleToggleTimeStep = function handleToggleTimeStep() {
|
|
1871
|
+
if (isTimestepAuto) {
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
onToggleTimestepAuto();
|
|
1875
|
+
timeStepFromLayer && onChangeTimeStep(timeStepFromLayer);
|
|
1876
|
+
};
|
|
1877
|
+
var layerHasTimeStep = Boolean(timeStepFromLayer);
|
|
1878
|
+
renderCounter.count(TimeStepButton.name);
|
|
1879
|
+
var _useState = useState(isOpenByDefault),
|
|
1880
|
+
open = _useState[0],
|
|
1881
|
+
setOpen = _useState[1];
|
|
1882
|
+
return jsx(TimeSliderMenu, {
|
|
1883
|
+
allOptionsDisabled: disabled,
|
|
1884
|
+
displayCurrentLength: true,
|
|
1885
|
+
handleAutoClick: handleToggleTimeStep,
|
|
1886
|
+
icon: jsx(FastForward, {
|
|
1887
|
+
"data-testid": "timeStepButton"
|
|
1888
|
+
}),
|
|
1889
|
+
isAutoDisabled: !layerHasTimeStep,
|
|
1890
|
+
isAutoSelected: isTimestepAuto,
|
|
1891
|
+
marks: translatedMarks,
|
|
1892
|
+
onChangeSliderValue: onMenuItemClick,
|
|
1893
|
+
open: open,
|
|
1894
|
+
setOpen: setOpen,
|
|
1895
|
+
title: t('timeslider-time-step'),
|
|
1896
|
+
value: timeStep || translatedMarks[0].value
|
|
1929
1897
|
});
|
|
1930
1898
|
};
|
|
1931
1899
|
|
|
1932
|
-
var
|
|
1933
|
-
var
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
1900
|
+
var OptionsMenu = function OptionsMenu(_ref) {
|
|
1901
|
+
var speedBtn = _ref.speedBtn,
|
|
1902
|
+
timeSpanBtn = _ref.timeSpanBtn,
|
|
1903
|
+
timeStepBtn = _ref.timeStepBtn,
|
|
1904
|
+
animationLengthBtn = _ref.animationLengthBtn;
|
|
1938
1905
|
return jsxs(Fragment, {
|
|
1939
1906
|
children: [jsx(Grid, {
|
|
1940
|
-
|
|
1941
|
-
|
|
1907
|
+
size: {
|
|
1908
|
+
xs: 'auto'
|
|
1909
|
+
},
|
|
1910
|
+
children: timeSpanBtn || jsx(TimeSpanButton, {
|
|
1911
|
+
disabled: false,
|
|
1912
|
+
isTimeSpanAuto: false,
|
|
1913
|
+
layerHasTimeStep: false,
|
|
1914
|
+
onChangeSliderValue: function onChangeSliderValue() {},
|
|
1915
|
+
onToggleTimeSpan: function onToggleTimeSpan() {},
|
|
1916
|
+
timeSliderSpan: 0
|
|
1942
1917
|
})
|
|
1943
1918
|
}), jsx(Grid, {
|
|
1944
|
-
|
|
1945
|
-
|
|
1919
|
+
size: {
|
|
1920
|
+
xs: 'auto'
|
|
1921
|
+
},
|
|
1922
|
+
children: animationLengthBtn || jsx(AnimationLengthButton, {
|
|
1923
|
+
onChangeAnimationLength: function onChangeAnimationLength() {},
|
|
1924
|
+
toggleAnimationLengthAuto: function toggleAnimationLengthAuto() {}
|
|
1946
1925
|
})
|
|
1947
1926
|
}), jsx(Grid, {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1927
|
+
size: {
|
|
1928
|
+
xs: 'auto'
|
|
1929
|
+
},
|
|
1930
|
+
children: timeStepBtn || jsx(TimeStepButton, {
|
|
1931
|
+
isTimestepAuto: false,
|
|
1932
|
+
onChangeTimeStep: function onChangeTimeStep() {}
|
|
1933
|
+
})
|
|
1951
1934
|
}), jsx(Grid, {
|
|
1952
|
-
|
|
1935
|
+
size: {
|
|
1936
|
+
xs: 'auto'
|
|
1937
|
+
},
|
|
1938
|
+
children: speedBtn || jsx(SpeedButton, {
|
|
1939
|
+
animationDelay: defaultAnimationDelayAtStart,
|
|
1940
|
+
setMapAnimationDelay: function setMapAnimationDelay() {}
|
|
1941
|
+
})
|
|
1953
1942
|
})]
|
|
1954
1943
|
});
|
|
1955
1944
|
};
|
|
@@ -1966,16 +1955,19 @@ var PopperMenu = function PopperMenu(_ref) {
|
|
|
1966
1955
|
var direction = ['bottom', 'top'].includes(popperPlacement) ? 'column' : 'row';
|
|
1967
1956
|
var margin = getMargin(buttonElement, popperPlacement);
|
|
1968
1957
|
return jsx(Popper, {
|
|
1958
|
+
anchorEl: direction === 'row' ? buttonElement == null ? void 0 : buttonElement.parentElement : buttonElement,
|
|
1959
|
+
open: isPopperOpen,
|
|
1960
|
+
placement: popperPlacement,
|
|
1969
1961
|
sx: {
|
|
1970
1962
|
zIndex: 3
|
|
1971
1963
|
},
|
|
1972
|
-
placement: popperPlacement,
|
|
1973
|
-
open: isPopperOpen,
|
|
1974
|
-
anchorEl: direction === 'row' ? buttonElement == null ? void 0 : buttonElement.parentElement : buttonElement,
|
|
1975
1964
|
children: jsx(Paper, {
|
|
1976
|
-
sx: Object.assign({}, margin),
|
|
1977
1965
|
elevation: 3,
|
|
1966
|
+
sx: Object.assign({}, margin),
|
|
1978
1967
|
children: jsxs(Grid, {
|
|
1968
|
+
container: true,
|
|
1969
|
+
direction: direction,
|
|
1970
|
+
spacing: 0.5,
|
|
1979
1971
|
sx: Object.assign({
|
|
1980
1972
|
padding: '4px 8px 8px'
|
|
1981
1973
|
}, direction === 'column' && {
|
|
@@ -1985,9 +1977,6 @@ var PopperMenu = function PopperMenu(_ref) {
|
|
|
1985
1977
|
}, direction === 'row' && {
|
|
1986
1978
|
marginTop: -0.5
|
|
1987
1979
|
}),
|
|
1988
|
-
container: true,
|
|
1989
|
-
spacing: 0.5,
|
|
1990
|
-
direction: direction,
|
|
1991
1980
|
children: [options != null ? options : jsx(OptionsMenu, {}), controls != null ? controls : jsx(ControlButtons, {})]
|
|
1992
1981
|
})
|
|
1993
1982
|
})
|
|
@@ -2072,41 +2061,53 @@ var TimeSliderClock = function TimeSliderClock(_ref2) {
|
|
|
2072
2061
|
}, [buttonElement, isPopperOpenByDefault]);
|
|
2073
2062
|
return jsxs(Fragment, {
|
|
2074
2063
|
children: [jsx(PopperMenu, {
|
|
2075
|
-
popperPlacement: popperPlacement,
|
|
2076
|
-
isPopperOpen: isPopperOpen,
|
|
2077
2064
|
buttonElement: buttonElement,
|
|
2065
|
+
controls: controls,
|
|
2066
|
+
isPopperOpen: isPopperOpen,
|
|
2078
2067
|
options: options,
|
|
2079
|
-
|
|
2068
|
+
popperPlacement: popperPlacement
|
|
2080
2069
|
}), jsx(Draggable, {
|
|
2070
|
+
bounds: "parent",
|
|
2081
2071
|
cancel: ".MuiButtonBase-root",
|
|
2082
2072
|
nodeRef: clockElement,
|
|
2083
|
-
bounds: "parent",
|
|
2084
|
-
position: position,
|
|
2085
2073
|
onStop: function onStop(_event, position) {
|
|
2086
2074
|
setPosition(position);
|
|
2087
2075
|
setPopperPlacement(getPopperplacement(clockElement.current));
|
|
2088
2076
|
},
|
|
2077
|
+
position: position,
|
|
2089
2078
|
children: jsx("div", {
|
|
2079
|
+
ref: function ref(_ref3) {
|
|
2080
|
+
clockElement.current = _ref3;
|
|
2081
|
+
setPopperPlacement(getPopperplacement(_ref3));
|
|
2082
|
+
},
|
|
2090
2083
|
style: {
|
|
2091
2084
|
position: 'absolute',
|
|
2092
2085
|
zIndex: 1001,
|
|
2093
2086
|
top: '10px',
|
|
2094
2087
|
right: '10px'
|
|
2095
2088
|
},
|
|
2096
|
-
ref: function ref(_ref3) {
|
|
2097
|
-
clockElement.current = _ref3;
|
|
2098
|
-
setPopperPlacement(getPopperplacement(_ref3));
|
|
2099
|
-
},
|
|
2100
2089
|
children: jsx(Resizable, {
|
|
2101
|
-
|
|
2102
|
-
|
|
2090
|
+
enable: resizeHandlePlacement,
|
|
2091
|
+
handleComponent: {
|
|
2092
|
+
bottomLeft: jsx(Resize, {
|
|
2093
|
+
isRightAligned: true,
|
|
2094
|
+
style: {
|
|
2095
|
+
fill: '#FFFFFF'
|
|
2096
|
+
}
|
|
2097
|
+
})
|
|
2103
2098
|
},
|
|
2099
|
+
lockAspectRatio: true,
|
|
2100
|
+
minHeight: MIN_HEIGHT,
|
|
2101
|
+
minWidth: hideButton ? MIN_WIDTH : MIN_WIDTH + BUTTON_WIDTH,
|
|
2104
2102
|
onResize: function onResize(_event, _direction, _ref, delta) {
|
|
2105
2103
|
var width = size.width + delta.width;
|
|
2106
2104
|
var adjustedWidth = hideButton ? width : width - BUTTON_WIDTH;
|
|
2107
2105
|
var fontSize = FONT_SIZE_WIDTH_RATIO * adjustedWidth;
|
|
2108
2106
|
setFontSize(fontSize);
|
|
2109
2107
|
},
|
|
2108
|
+
onResizeStart: function onResizeStart(event) {
|
|
2109
|
+
event.stopPropagation();
|
|
2110
|
+
},
|
|
2110
2111
|
onResizeStop: function onResizeStop(_event, _direction, _ref, delta) {
|
|
2111
2112
|
var width = size.width + delta.width;
|
|
2112
2113
|
var height = size.height + delta.height;
|
|
@@ -2116,32 +2117,20 @@ var TimeSliderClock = function TimeSliderClock(_ref2) {
|
|
|
2116
2117
|
});
|
|
2117
2118
|
setPopperPlacement(getPopperplacement(clockElement.current));
|
|
2118
2119
|
},
|
|
2119
|
-
lockAspectRatio: true,
|
|
2120
|
-
minHeight: MIN_HEIGHT,
|
|
2121
|
-
minWidth: hideButton ? MIN_WIDTH : MIN_WIDTH + BUTTON_WIDTH,
|
|
2122
2120
|
size: size,
|
|
2123
|
-
handleComponent: {
|
|
2124
|
-
bottomLeft: jsx(Resize, {
|
|
2125
|
-
isRightAligned: true,
|
|
2126
|
-
style: {
|
|
2127
|
-
fill: '#FFFFFF'
|
|
2128
|
-
}
|
|
2129
|
-
})
|
|
2130
|
-
},
|
|
2131
|
-
enable: resizeHandlePlacement,
|
|
2132
2121
|
children: jsx(ClockContainer, {
|
|
2122
|
+
fontSize: fontSize,
|
|
2133
2123
|
hideButton: hideButton,
|
|
2124
|
+
isPopperOpen: isPopperOpen,
|
|
2134
2125
|
onButtonClick: function onButtonClick() {
|
|
2135
2126
|
if (!isPopperOpen) {
|
|
2136
2127
|
setPopperPlacement(getPopperplacement(clockElement.current));
|
|
2137
2128
|
}
|
|
2138
2129
|
setIsPopperOpen(!isPopperOpen);
|
|
2139
2130
|
},
|
|
2140
|
-
|
|
2141
|
-
fontSize: fontSize,
|
|
2142
|
-
time: time,
|
|
2131
|
+
popperPlacement: popperPlacement,
|
|
2143
2132
|
setButtonElement: setButtonElement,
|
|
2144
|
-
|
|
2133
|
+
time: time
|
|
2145
2134
|
})
|
|
2146
2135
|
})
|
|
2147
2136
|
})
|
|
@@ -2530,124 +2519,39 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
2530
2519
|
var timeFormat = getTimeFormat(fundamentalScale);
|
|
2531
2520
|
var timeText = dateUtils.dateToString(dateUtils.fromUnix(timestep), timeFormat);
|
|
2532
2521
|
if ([Scale.Minutes5, Scale.Hour, Scale.Hours3, Scale.Hours6, Scale.Day].includes(fundamentalScale) &&
|
|
2533
|
-
// eslint-disable-next-line @typescript-eslint/no-confusing-non-null-assertion
|
|
2534
|
-
timestep % scaleToUnitSeconds[fundamentalScale] === 0 || fundamentalScale === Scale.Week && dateUtils.getDay(dateUtils.fromUnix(timestep)) === 1) {
|
|
2535
|
-
drawTimeText(ctx, theme, stepPx, height, timeText, fundamentalScale);
|
|
2536
|
-
}
|
|
2537
|
-
if (fundamentalScale === Scale.Year && dateUtils.getMonth(dateUtils.fromUnix(timestep)) === 0) {
|
|
2538
|
-
drawYearScaleText(ctx, theme, timeText, stepPx, height);
|
|
2539
|
-
}
|
|
2540
|
-
});
|
|
2541
|
-
// draw month overlay lines
|
|
2542
|
-
if (fundamentalScale === Scale.Week || fundamentalScale === Scale.Weeks2 || fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
2543
|
-
var _getCustomRoundedStar = getCustomRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, Scale.Year),
|
|
2544
|
-
_roundedStart = _getCustomRoundedStar[0],
|
|
2545
|
-
_roundedEnd = _getCustomRoundedStar[1];
|
|
2546
|
-
var monthTimesteps = getCustomTimesteps(_roundedStart, _roundedEnd, 'months');
|
|
2547
|
-
monthTimesteps.forEach(function (timestep) {
|
|
2548
|
-
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
2549
|
-
if (fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
2550
|
-
var month = dateUtils.dateToString(dateUtils.fromUnix(timestep), 'MMM');
|
|
2551
|
-
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2552
|
-
drawDateChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
2553
|
-
drawTimeText(ctx, theme, stepPx, height, month, fundamentalScale);
|
|
2554
|
-
return;
|
|
2555
|
-
}
|
|
2556
|
-
// adding 0.5 to make line not so blurred
|
|
2557
|
-
drawDashedMonthChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
2558
|
-
});
|
|
2559
|
-
}
|
|
2560
|
-
// draw date change texts
|
|
2561
|
-
if (fundamentalScale === Scale.Year) {
|
|
2562
|
-
return;
|
|
2563
|
-
}
|
|
2564
|
-
var dateText = getLeftSideDateText(visibleTimeStart, fundamentalScale);
|
|
2565
|
-
drawLeftSideDateText(ctx, theme, dateText, height);
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
/* *
|
|
2569
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2570
|
-
* you may not use this file except in compliance with the License.
|
|
2571
|
-
* You may obtain a copy of the License at
|
|
2572
|
-
*
|
|
2573
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2574
|
-
*
|
|
2575
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2576
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2577
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2578
|
-
* See the License for the specific language governing permissions and
|
|
2579
|
-
* limitations under the License.
|
|
2580
|
-
*
|
|
2581
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2582
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2583
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2584
|
-
* */
|
|
2585
|
-
var drawNeedle = function drawNeedle(context, theme, width, height, startTime, endTime, selectedTime) {
|
|
2586
|
-
if (!selectedTime) {
|
|
2587
|
-
return;
|
|
2588
|
-
}
|
|
2589
|
-
var ctx = context;
|
|
2590
|
-
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
2591
|
-
playerNeedlePlayer = _theme$palette$geoweb.playerNeedlePlayer,
|
|
2592
|
-
playerNeedlePlayerTop = _theme$palette$geoweb.playerNeedlePlayerTop,
|
|
2593
|
-
playerTimeMarkers = _theme$palette$geoweb.playerTimeMarkers;
|
|
2594
|
-
var selectedPx = timestampToPixelEdges(selectedTime, startTime, endTime, width);
|
|
2595
|
-
// Draw a high vertical line (needle) indicating the current or selected time
|
|
2596
|
-
ctx.beginPath();
|
|
2597
|
-
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2598
|
-
ctx.moveTo(Math.floor(selectedPx) + 0.5, height - 50);
|
|
2599
|
-
ctx.lineTo(Math.floor(selectedPx) + 0.5, height);
|
|
2600
|
-
ctx.lineWidth = 5;
|
|
2601
|
-
ctx.strokeStyle = playerNeedlePlayer.rgba;
|
|
2602
|
-
ctx.stroke();
|
|
2603
|
-
ctx.lineWidth = 1;
|
|
2604
|
-
ctx.strokeStyle = playerNeedlePlayerTop.rgba;
|
|
2605
|
-
ctx.stroke();
|
|
2606
|
-
// Triange connecting timebox.
|
|
2607
|
-
ctx.beginPath();
|
|
2608
|
-
ctx.moveTo(Math.floor(selectedPx) + 5, 0);
|
|
2609
|
-
ctx.lineTo(Math.floor(selectedPx) + 0.5, 5);
|
|
2610
|
-
ctx.lineTo(Math.floor(selectedPx) - 5, 0);
|
|
2611
|
-
ctx.closePath();
|
|
2612
|
-
ctx.fillStyle = playerTimeMarkers.fill;
|
|
2613
|
-
ctx.fill();
|
|
2614
|
-
};
|
|
2615
|
-
|
|
2616
|
-
/* *
|
|
2617
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2618
|
-
* you may not use this file except in compliance with the License.
|
|
2619
|
-
* You may obtain a copy of the License at
|
|
2620
|
-
*
|
|
2621
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2622
|
-
*
|
|
2623
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2624
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2625
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2626
|
-
* See the License for the specific language governing permissions and
|
|
2627
|
-
* limitations under the License.
|
|
2628
|
-
*
|
|
2629
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2630
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2631
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2632
|
-
* */
|
|
2633
|
-
var drawCurrentTime = function drawCurrentTime(context, theme, width, height, startTime, endTime, currentTime) {
|
|
2634
|
-
var ctx = context;
|
|
2635
|
-
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
2636
|
-
playerNeedleTime = _theme$palette$geoweb.playerNeedleTime,
|
|
2637
|
-
playerNeedleTimeTop = _theme$palette$geoweb.playerNeedleTimeTop;
|
|
2638
|
-
var current = currentTime;
|
|
2639
|
-
var currentPx = current ? timestampToPixelEdges(current, startTime, endTime, width) : 0;
|
|
2640
|
-
// Draw a high vertical line (needle) indicating the current or selected time
|
|
2641
|
-
ctx.beginPath();
|
|
2642
|
-
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2643
|
-
ctx.moveTo(Math.floor(currentPx) + 0.5, height - 24);
|
|
2644
|
-
ctx.lineTo(Math.floor(currentPx) + 0.5, height);
|
|
2645
|
-
ctx.lineWidth = 5;
|
|
2646
|
-
ctx.strokeStyle = playerNeedleTime.rgba;
|
|
2647
|
-
ctx.stroke();
|
|
2648
|
-
ctx.lineWidth = 1;
|
|
2649
|
-
ctx.strokeStyle = playerNeedleTimeTop.rgba;
|
|
2650
|
-
ctx.stroke();
|
|
2522
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-non-null-assertion
|
|
2523
|
+
timestep % scaleToUnitSeconds[fundamentalScale] === 0 || fundamentalScale === Scale.Week && dateUtils.getDay(dateUtils.fromUnix(timestep)) === 1) {
|
|
2524
|
+
drawTimeText(ctx, theme, stepPx, height, timeText, fundamentalScale);
|
|
2525
|
+
}
|
|
2526
|
+
if (fundamentalScale === Scale.Year && dateUtils.getMonth(dateUtils.fromUnix(timestep)) === 0) {
|
|
2527
|
+
drawYearScaleText(ctx, theme, timeText, stepPx, height);
|
|
2528
|
+
}
|
|
2529
|
+
});
|
|
2530
|
+
// draw month overlay lines
|
|
2531
|
+
if (fundamentalScale === Scale.Week || fundamentalScale === Scale.Weeks2 || fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
2532
|
+
var _getCustomRoundedStar = getCustomRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, Scale.Year),
|
|
2533
|
+
_roundedStart = _getCustomRoundedStar[0],
|
|
2534
|
+
_roundedEnd = _getCustomRoundedStar[1];
|
|
2535
|
+
var monthTimesteps = getCustomTimesteps(_roundedStart, _roundedEnd, 'months');
|
|
2536
|
+
monthTimesteps.forEach(function (timestep) {
|
|
2537
|
+
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
2538
|
+
if (fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
2539
|
+
var month = dateUtils.dateToString(dateUtils.fromUnix(timestep), 'MMM');
|
|
2540
|
+
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2541
|
+
drawDateChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
2542
|
+
drawTimeText(ctx, theme, stepPx, height, month, fundamentalScale);
|
|
2543
|
+
return;
|
|
2544
|
+
}
|
|
2545
|
+
// adding 0.5 to make line not so blurred
|
|
2546
|
+
drawDashedMonthChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
// draw date change texts
|
|
2550
|
+
if (fundamentalScale === Scale.Year) {
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
var dateText = getLeftSideDateText(visibleTimeStart, fundamentalScale);
|
|
2554
|
+
drawLeftSideDateText(ctx, theme, dateText, height);
|
|
2651
2555
|
};
|
|
2652
2556
|
|
|
2653
2557
|
/* *
|
|
@@ -2779,6 +2683,91 @@ function getColorChangeTimesteps(scale, visibleTimeStart, visibleTimeEnd) {
|
|
|
2779
2683
|
return colorChangeTimesteps;
|
|
2780
2684
|
}
|
|
2781
2685
|
|
|
2686
|
+
/* *
|
|
2687
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2688
|
+
* you may not use this file except in compliance with the License.
|
|
2689
|
+
* You may obtain a copy of the License at
|
|
2690
|
+
*
|
|
2691
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2692
|
+
*
|
|
2693
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2694
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2695
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2696
|
+
* See the License for the specific language governing permissions and
|
|
2697
|
+
* limitations under the License.
|
|
2698
|
+
*
|
|
2699
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2700
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2701
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2702
|
+
* */
|
|
2703
|
+
var drawCurrentTime = function drawCurrentTime(context, theme, width, height, startTime, endTime, currentTime) {
|
|
2704
|
+
var ctx = context;
|
|
2705
|
+
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
2706
|
+
playerNeedleTime = _theme$palette$geoweb.playerNeedleTime,
|
|
2707
|
+
playerNeedleTimeTop = _theme$palette$geoweb.playerNeedleTimeTop;
|
|
2708
|
+
var current = currentTime;
|
|
2709
|
+
var currentPx = current ? timestampToPixelEdges(current, startTime, endTime, width) : 0;
|
|
2710
|
+
// Draw a high vertical line (needle) indicating the current or selected time
|
|
2711
|
+
ctx.beginPath();
|
|
2712
|
+
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2713
|
+
ctx.moveTo(Math.floor(currentPx) + 0.5, height - 24);
|
|
2714
|
+
ctx.lineTo(Math.floor(currentPx) + 0.5, height);
|
|
2715
|
+
ctx.lineWidth = 5;
|
|
2716
|
+
ctx.strokeStyle = playerNeedleTime.rgba;
|
|
2717
|
+
ctx.stroke();
|
|
2718
|
+
ctx.lineWidth = 1;
|
|
2719
|
+
ctx.strokeStyle = playerNeedleTimeTop.rgba;
|
|
2720
|
+
ctx.stroke();
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
/* *
|
|
2724
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2725
|
+
* you may not use this file except in compliance with the License.
|
|
2726
|
+
* You may obtain a copy of the License at
|
|
2727
|
+
*
|
|
2728
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2729
|
+
*
|
|
2730
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2731
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2732
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2733
|
+
* See the License for the specific language governing permissions and
|
|
2734
|
+
* limitations under the License.
|
|
2735
|
+
*
|
|
2736
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2737
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2738
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2739
|
+
* */
|
|
2740
|
+
var drawNeedle = function drawNeedle(context, theme, width, height, startTime, endTime, selectedTime) {
|
|
2741
|
+
if (!selectedTime) {
|
|
2742
|
+
return;
|
|
2743
|
+
}
|
|
2744
|
+
var ctx = context;
|
|
2745
|
+
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
2746
|
+
playerNeedlePlayer = _theme$palette$geoweb.playerNeedlePlayer,
|
|
2747
|
+
playerNeedlePlayerTop = _theme$palette$geoweb.playerNeedlePlayerTop,
|
|
2748
|
+
playerTimeMarkers = _theme$palette$geoweb.playerTimeMarkers;
|
|
2749
|
+
var selectedPx = timestampToPixelEdges(selectedTime, startTime, endTime, width);
|
|
2750
|
+
// Draw a high vertical line (needle) indicating the current or selected time
|
|
2751
|
+
ctx.beginPath();
|
|
2752
|
+
// Move 1 pixel line by 0.5 pixels to prevent it from being shown as blurry: https://usefulangle.com/post/17/html5-canvas-drawing-1px-crisp-straight-lines
|
|
2753
|
+
ctx.moveTo(Math.floor(selectedPx) + 0.5, height - 50);
|
|
2754
|
+
ctx.lineTo(Math.floor(selectedPx) + 0.5, height);
|
|
2755
|
+
ctx.lineWidth = 5;
|
|
2756
|
+
ctx.strokeStyle = playerNeedlePlayer.rgba;
|
|
2757
|
+
ctx.stroke();
|
|
2758
|
+
ctx.lineWidth = 1;
|
|
2759
|
+
ctx.strokeStyle = playerNeedlePlayerTop.rgba;
|
|
2760
|
+
ctx.stroke();
|
|
2761
|
+
// Triange connecting timebox.
|
|
2762
|
+
ctx.beginPath();
|
|
2763
|
+
ctx.moveTo(Math.floor(selectedPx) + 5, 0);
|
|
2764
|
+
ctx.lineTo(Math.floor(selectedPx) + 0.5, 5);
|
|
2765
|
+
ctx.lineTo(Math.floor(selectedPx) - 5, 0);
|
|
2766
|
+
ctx.closePath();
|
|
2767
|
+
ctx.fillStyle = playerTimeMarkers.fill;
|
|
2768
|
+
ctx.fill();
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2782
2771
|
/* *
|
|
2783
2772
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2784
2773
|
* you may not use this file except in compliance with the License.
|
|
@@ -2973,7 +2962,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2973
2962
|
if (lastHandledRoundedTime !== startTime) {
|
|
2974
2963
|
setLastHandledRoundedTime(startTime);
|
|
2975
2964
|
setShowTooltip('animationStart');
|
|
2976
|
-
onStartTimeChange
|
|
2965
|
+
onStartTimeChange == null || onStartTimeChange(startTime);
|
|
2977
2966
|
}
|
|
2978
2967
|
} else if (isDraggingEndAnimation && pixelsBetweenOnLeft) {
|
|
2979
2968
|
if (isDraggingEndWithinBounds(startPos, mousePosition, canvasWidth)) {
|
|
@@ -2983,7 +2972,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2983
2972
|
if (lastHandledRoundedTime !== endTime) {
|
|
2984
2973
|
setLastHandledRoundedTime(endTime);
|
|
2985
2974
|
setShowTooltip('animationEnd');
|
|
2986
|
-
onEndTimeChange
|
|
2975
|
+
onEndTimeChange == null || onEndTimeChange(endTime);
|
|
2987
2976
|
}
|
|
2988
2977
|
}
|
|
2989
2978
|
if (isDraggingAnimationArea) {
|
|
@@ -3041,13 +3030,13 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3041
3030
|
useEffect(function () {
|
|
3042
3031
|
var handleMouseUp = function handleMouseUp() {
|
|
3043
3032
|
if (isDraggingAnimationArea) {
|
|
3044
|
-
onStartTimeChange
|
|
3045
|
-
onEndTimeChange
|
|
3033
|
+
onStartTimeChange == null || onStartTimeChange(localAnimationStartTime);
|
|
3034
|
+
onEndTimeChange == null || onEndTimeChange(localAnimationEndTime);
|
|
3046
3035
|
}
|
|
3047
3036
|
setCursorStyle('auto');
|
|
3048
3037
|
setIsDraggingSelectedTime(false);
|
|
3049
|
-
setIsDraggingStartAnimation
|
|
3050
|
-
setIsDraggingEndAnimation
|
|
3038
|
+
setIsDraggingStartAnimation == null || setIsDraggingStartAnimation(false);
|
|
3039
|
+
setIsDraggingEndAnimation == null || setIsDraggingEndAnimation(false);
|
|
3051
3040
|
setIsDraggingLegend(false);
|
|
3052
3041
|
setShowTooltip(undefined);
|
|
3053
3042
|
setIsDraggingAnimationArea(false);
|
|
@@ -3122,13 +3111,13 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3122
3111
|
// start dragging either marker
|
|
3123
3112
|
if (isLeftAnimationIconArea(x, startAnimationPosition, DRAG_AREA_WIDTH)) {
|
|
3124
3113
|
setCursorStyle('grabbing');
|
|
3125
|
-
setIsDraggingStartAnimation
|
|
3114
|
+
setIsDraggingStartAnimation == null || setIsDraggingStartAnimation(true);
|
|
3126
3115
|
setShowTooltip('animationStart');
|
|
3127
3116
|
return;
|
|
3128
3117
|
}
|
|
3129
3118
|
if (isRightAnimationIconArea(x, endAnimationPosition, DRAG_AREA_WIDTH)) {
|
|
3130
3119
|
setCursorStyle('grabbing');
|
|
3131
|
-
setIsDraggingEndAnimation
|
|
3120
|
+
setIsDraggingEndAnimation == null || setIsDraggingEndAnimation(true);
|
|
3132
3121
|
setShowTooltip('animationEnd');
|
|
3133
3122
|
return;
|
|
3134
3123
|
}
|
|
@@ -3214,7 +3203,6 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3214
3203
|
height: TIME_SLIDER_LEGEND_HEIGHT + "px"
|
|
3215
3204
|
},
|
|
3216
3205
|
children: [jsx(CustomTooltip, {
|
|
3217
|
-
title: getTooltipText(),
|
|
3218
3206
|
open: Boolean(showTooltip),
|
|
3219
3207
|
slotProps: {
|
|
3220
3208
|
popper: {
|
|
@@ -3224,32 +3212,39 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3224
3212
|
}
|
|
3225
3213
|
}
|
|
3226
3214
|
},
|
|
3215
|
+
title: getTooltipText(),
|
|
3227
3216
|
children: jsx(Box, {
|
|
3228
|
-
"data-testid": "timeSliderLegend",
|
|
3229
3217
|
className: getTimeSliderLegendId(mapId),
|
|
3218
|
+
"data-testid": "timeSliderLegend",
|
|
3219
|
+
onMouseLeave: function onMouseLeave() {
|
|
3220
|
+
setPointerTime(undefined);
|
|
3221
|
+
},
|
|
3230
3222
|
sx: {
|
|
3231
3223
|
height: TIME_SLIDER_LEGEND_HEIGHT + "px",
|
|
3232
3224
|
borderRadius: '4.5px',
|
|
3233
3225
|
overflow: 'hidden',
|
|
3234
3226
|
cursor: cursorStyle
|
|
3235
3227
|
},
|
|
3236
|
-
onMouseLeave: function onMouseLeave() {
|
|
3237
|
-
setPointerTime(undefined);
|
|
3238
|
-
},
|
|
3239
3228
|
children: jsx(CanvasComponent, {
|
|
3240
|
-
ref: node,
|
|
3241
|
-
onMouseMove: onMouseMove,
|
|
3242
|
-
onWheel: onWheelOverCanvas,
|
|
3243
3229
|
onMouseDown: onMouseDown,
|
|
3230
|
+
onMouseMove: onMouseMove,
|
|
3244
3231
|
onMouseUp: onMouseUp,
|
|
3245
3232
|
onRenderCanvas: function onRenderCanvas(ctx, width, height) {
|
|
3246
3233
|
updateCanvasWidth(canvasWidth, width);
|
|
3247
3234
|
drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, timeSliderSpan, filteredTime, currentTime, start, end, dataStartTime, dataEndTime);
|
|
3248
|
-
}
|
|
3235
|
+
},
|
|
3236
|
+
onWheel: onWheelOverCanvas,
|
|
3237
|
+
ref: node
|
|
3249
3238
|
})
|
|
3250
3239
|
})
|
|
3251
|
-
}), isTimeSliderHoverOn && jsx(Box, {
|
|
3240
|
+
}), !!isTimeSliderHoverOn && jsx(Box, {
|
|
3252
3241
|
"data-testid": "customCanvasMouseOverContainer",
|
|
3242
|
+
onMouseLeave: function onMouseLeave() {
|
|
3243
|
+
return setIsMouseOverCanvas(false);
|
|
3244
|
+
},
|
|
3245
|
+
onMouseOver: function onMouseOver() {
|
|
3246
|
+
return setIsMouseOverCanvas(true);
|
|
3247
|
+
},
|
|
3253
3248
|
sx: {
|
|
3254
3249
|
position: 'absolute',
|
|
3255
3250
|
top: '-40px',
|
|
@@ -3258,12 +3253,6 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3258
3253
|
bottom: 0,
|
|
3259
3254
|
height: TIME_SLIDER_LEGEND_HEIGHT + " + 40px",
|
|
3260
3255
|
zIndex: isMouseOverCanvas ? 100 : 0
|
|
3261
|
-
},
|
|
3262
|
-
onMouseOver: function onMouseOver() {
|
|
3263
|
-
return setIsMouseOverCanvas(true);
|
|
3264
|
-
},
|
|
3265
|
-
onMouseLeave: function onMouseLeave() {
|
|
3266
|
-
return setIsMouseOverCanvas(false);
|
|
3267
3256
|
}
|
|
3268
3257
|
})]
|
|
3269
3258
|
});
|
|
@@ -3291,29 +3280,29 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
3291
3280
|
}, [anchorEl, isOpenByDefault]);
|
|
3292
3281
|
return jsxs("div", {
|
|
3293
3282
|
children: [jsx(CustomIconButton, {
|
|
3294
|
-
|
|
3283
|
+
"aria-label": "animation options",
|
|
3284
|
+
"data-testid": "optionsMenuButton",
|
|
3285
|
+
isSelected: open,
|
|
3295
3286
|
onClick: function onClick() {
|
|
3296
3287
|
setOpen(!open);
|
|
3297
3288
|
},
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3289
|
+
ref: function ref(_ref2) {
|
|
3290
|
+
setAnchorEl(_ref2);
|
|
3291
|
+
},
|
|
3301
3292
|
tooltipProps: {
|
|
3302
3293
|
title: t('timeslider-animation-options'),
|
|
3303
3294
|
placement: 'bottom'
|
|
3304
3295
|
},
|
|
3305
|
-
|
|
3306
|
-
setAnchorEl(_ref2);
|
|
3307
|
-
},
|
|
3296
|
+
variant: "tool",
|
|
3308
3297
|
children: jsx(Options, {})
|
|
3309
3298
|
}), jsx(Popper, {
|
|
3299
|
+
anchorEl: anchorEl,
|
|
3300
|
+
"data-testid": "optionsMenuPopOver",
|
|
3301
|
+
open: open,
|
|
3302
|
+
placement: "top-start",
|
|
3310
3303
|
sx: {
|
|
3311
3304
|
zIndex: 10
|
|
3312
3305
|
},
|
|
3313
|
-
placement: "top-start",
|
|
3314
|
-
open: open,
|
|
3315
|
-
"data-testid": "optionsMenuPopOver",
|
|
3316
|
-
anchorEl: anchorEl,
|
|
3317
3306
|
children: jsx(Paper, {
|
|
3318
3307
|
elevation: 3,
|
|
3319
3308
|
sx: {
|
|
@@ -3321,16 +3310,16 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
3321
3310
|
top: '-2rem'
|
|
3322
3311
|
},
|
|
3323
3312
|
children: jsx(Grid, {
|
|
3313
|
+
container: true,
|
|
3314
|
+
spacing: 1,
|
|
3324
3315
|
sx: {
|
|
3325
3316
|
padding: '10px'
|
|
3326
3317
|
},
|
|
3327
|
-
container: true,
|
|
3328
|
-
spacing: 1,
|
|
3329
3318
|
children: jsx(OptionsMenu, {
|
|
3330
|
-
|
|
3331
|
-
timeStepBtn: timeStepBtn,
|
|
3319
|
+
animationLengthBtn: animationLengthBtn,
|
|
3332
3320
|
speedBtn: speedBtn,
|
|
3333
|
-
|
|
3321
|
+
timeSpanBtn: timeSpanBtn,
|
|
3322
|
+
timeStepBtn: timeStepBtn
|
|
3334
3323
|
})
|
|
3335
3324
|
})
|
|
3336
3325
|
})
|
|
@@ -3357,11 +3346,11 @@ var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
|
3357
3346
|
children: [jsx(Grid, {
|
|
3358
3347
|
children: optionsMenuBtn || jsx(OptionsMenuButton, {})
|
|
3359
3348
|
}), jsx(ControlButtons, {
|
|
3349
|
+
autoUpdateBtn: autoUpdateBtn,
|
|
3360
3350
|
backwardBtn: backwardBtn,
|
|
3361
3351
|
forwardBtn: forwardBtn,
|
|
3362
|
-
playBtn: playBtn,
|
|
3363
3352
|
nowBtn: nowBtn,
|
|
3364
|
-
|
|
3353
|
+
playBtn: playBtn
|
|
3365
3354
|
})]
|
|
3366
3355
|
})
|
|
3367
3356
|
});
|
|
@@ -3534,10 +3523,10 @@ var AvailableDayByTimeRange = function AvailableDayByTimeRange(props, isDisabled
|
|
|
3534
3523
|
today = props.today,
|
|
3535
3524
|
outsideCurrentMonth = props.outsideCurrentMonth,
|
|
3536
3525
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
3537
|
-
var _React$useState =
|
|
3526
|
+
var _React$useState = React.useState({}),
|
|
3538
3527
|
calendarDayStyle = _React$useState[0],
|
|
3539
3528
|
setCalendarDayStyle = _React$useState[1];
|
|
3540
|
-
|
|
3529
|
+
React.useEffect(function () {
|
|
3541
3530
|
if (outsideCurrentMonth || isDisabledStyle) {
|
|
3542
3531
|
setCalendarDayStyle(disabledButtonStyle);
|
|
3543
3532
|
} else if (today) {
|
|
@@ -3547,12 +3536,12 @@ var AvailableDayByTimeRange = function AvailableDayByTimeRange(props, isDisabled
|
|
|
3547
3536
|
}
|
|
3548
3537
|
}, [day, today, outsideCurrentMonth, isDisabledStyle]);
|
|
3549
3538
|
return /*#__PURE__*/createElement(PickersDay, Object.assign({}, other, {
|
|
3550
|
-
key: day.toString(),
|
|
3551
|
-
sx: Object.assign({}, calendarDayStyle),
|
|
3552
|
-
outsideCurrentMonth: outsideCurrentMonth,
|
|
3553
3539
|
day: day,
|
|
3540
|
+
disableHighlightToday: true,
|
|
3554
3541
|
disableMargin: true,
|
|
3555
|
-
|
|
3542
|
+
key: day.toString(),
|
|
3543
|
+
outsideCurrentMonth: outsideCurrentMonth,
|
|
3544
|
+
sx: Object.assign({}, calendarDayStyle)
|
|
3556
3545
|
}));
|
|
3557
3546
|
};
|
|
3558
3547
|
var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
@@ -3567,13 +3556,13 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3567
3556
|
onCancel = _ref$onCancel === void 0 ? function () {} : _ref$onCancel;
|
|
3568
3557
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
3569
3558
|
t = _useTimesliderTransla.t;
|
|
3570
|
-
var _React$useState2 =
|
|
3559
|
+
var _React$useState2 = React.useState(value ? toLocalTime(value) : null),
|
|
3571
3560
|
localTimeValue = _React$useState2[0],
|
|
3572
3561
|
setLocalTimeValue = _React$useState2[1];
|
|
3573
|
-
var _React$useState3 =
|
|
3562
|
+
var _React$useState3 = React.useState(!dataStartTime || !dataEndTime || dataStartTime > dataEndTime),
|
|
3574
3563
|
isUndefinedDateRange = _React$useState3[0],
|
|
3575
3564
|
setIsUndefinedDateRange = _React$useState3[1];
|
|
3576
|
-
var isDateRangeDisabled =
|
|
3565
|
+
var isDateRangeDisabled = React.useCallback(function (date) {
|
|
3577
3566
|
if (dataStartTime === undefined || dataEndTime === undefined || dataStartTime > dataEndTime) {
|
|
3578
3567
|
return true;
|
|
3579
3568
|
}
|
|
@@ -3583,7 +3572,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3583
3572
|
var day = dateUtils.unix(date);
|
|
3584
3573
|
return day < dateUtils.unix(startOfFirstDay) || day > dateUtils.unix(endOfLastDay);
|
|
3585
3574
|
}, [dataStartTime, dataEndTime]);
|
|
3586
|
-
var _React$useState4 =
|
|
3575
|
+
var _React$useState4 = React.useState(isDateRangeDisabled(localTimeValue)),
|
|
3587
3576
|
isDisabledRange = _React$useState4[0],
|
|
3588
3577
|
setIsDisabledRange = _React$useState4[1];
|
|
3589
3578
|
var handleSelect = function handleSelect() {
|
|
@@ -3609,7 +3598,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3609
3598
|
var AvailableDay = function AvailableDay(props) {
|
|
3610
3599
|
return AvailableDayByTimeRange(props, isDateRangeDisabled(props.day));
|
|
3611
3600
|
};
|
|
3612
|
-
|
|
3601
|
+
React.useEffect(function () {
|
|
3613
3602
|
setIsUndefinedDateRange(!dataStartTime || !dataEndTime || dataStartTime > dataEndTime);
|
|
3614
3603
|
setIsDisabledRange(isDateRangeDisabled(localTimeValue));
|
|
3615
3604
|
}, [dataStartTime, dataEndTime, localTimeValue, isDateRangeDisabled]);
|
|
@@ -3649,36 +3638,28 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3649
3638
|
}), jsx(LocalizationProvider, {
|
|
3650
3639
|
dateAdapter: AdapterDateFns,
|
|
3651
3640
|
children: jsx(DateTimePicker, {
|
|
3652
|
-
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
3653
|
-
label: t('timeslider-marker-label'),
|
|
3654
3641
|
ampm: false,
|
|
3655
|
-
|
|
3642
|
+
autoFocus: true,
|
|
3643
|
+
closeOnSelect: false,
|
|
3644
|
+
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
3645
|
+
disableIgnoringDatePartForTimeValidation: true,
|
|
3656
3646
|
format: format,
|
|
3647
|
+
label: t('timeslider-marker-label'),
|
|
3648
|
+
maxDateTime: isUndefinedDateRange ? undefined : toLocalTime(dataEndTime),
|
|
3649
|
+
minDateTime: isUndefinedDateRange ? undefined : toLocalTime(dataStartTime),
|
|
3657
3650
|
onChange: handleDateChange,
|
|
3658
|
-
closeOnSelect: false,
|
|
3659
3651
|
onClose: handleSelect,
|
|
3660
|
-
autoFocus: true,
|
|
3661
|
-
disableIgnoringDatePartForTimeValidation: true,
|
|
3662
3652
|
shouldDisableDate: isDisabledDateWithSomeAvailableData,
|
|
3663
|
-
minDateTime: isUndefinedDateRange ? undefined : toLocalTime(dataStartTime),
|
|
3664
|
-
maxDateTime: isUndefinedDateRange ? undefined : toLocalTime(dataEndTime),
|
|
3665
|
-
sx: {
|
|
3666
|
-
marginTop: '8px',
|
|
3667
|
-
marginBottom: '8px',
|
|
3668
|
-
marginLeft: '8px',
|
|
3669
|
-
marginRight: '8px',
|
|
3670
|
-
borderRadius: '0px'
|
|
3671
|
-
},
|
|
3672
3653
|
slotProps: {
|
|
3673
3654
|
textField: {
|
|
3674
3655
|
variant: 'filled',
|
|
3675
3656
|
InputProps: {
|
|
3676
3657
|
onKeyDownCapture: handleKeyDown,
|
|
3677
3658
|
endAdornment: jsx(InputAdornment, {
|
|
3659
|
+
position: "end",
|
|
3678
3660
|
sx: {
|
|
3679
3661
|
paddingTop: '16px'
|
|
3680
3662
|
},
|
|
3681
|
-
position: "end",
|
|
3682
3663
|
children: "UTC"
|
|
3683
3664
|
})
|
|
3684
3665
|
}
|
|
@@ -3697,9 +3678,17 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3697
3678
|
openPickerIcon: OpenPicker,
|
|
3698
3679
|
day: AvailableDay
|
|
3699
3680
|
},
|
|
3681
|
+
sx: {
|
|
3682
|
+
marginTop: '8px',
|
|
3683
|
+
marginBottom: '8px',
|
|
3684
|
+
marginLeft: '8px',
|
|
3685
|
+
marginRight: '8px',
|
|
3686
|
+
borderRadius: '0px'
|
|
3687
|
+
},
|
|
3700
3688
|
timeSteps: {
|
|
3701
3689
|
minutes: 1
|
|
3702
|
-
}
|
|
3690
|
+
},
|
|
3691
|
+
value: localTimeValue
|
|
3703
3692
|
})
|
|
3704
3693
|
})]
|
|
3705
3694
|
})
|
|
@@ -3730,19 +3719,19 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3730
3719
|
selectedTime = _ref.selectedTime,
|
|
3731
3720
|
_ref$onSelect = _ref.onSelect,
|
|
3732
3721
|
_onSelect = _ref$onSelect === void 0 ? function () {} : _ref$onSelect;
|
|
3733
|
-
var _React$useState =
|
|
3722
|
+
var _React$useState = React.useState(null),
|
|
3734
3723
|
anchorEl = _React$useState[0],
|
|
3735
3724
|
setAnchorEl = _React$useState[1];
|
|
3736
|
-
var _React$useState2 =
|
|
3725
|
+
var _React$useState2 = React.useState(false),
|
|
3737
3726
|
open = _React$useState2[0],
|
|
3738
3727
|
setOpen = _React$useState2[1];
|
|
3739
3728
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
3740
3729
|
t = _useTimesliderTransla.t;
|
|
3741
3730
|
return jsx(ClickAwayListener, {
|
|
3731
|
+
mouseEvent: "onMouseDown",
|
|
3742
3732
|
onClickAway: function onClickAway() {
|
|
3743
3733
|
return setOpen(false);
|
|
3744
3734
|
},
|
|
3745
|
-
mouseEvent: "onMouseDown",
|
|
3746
3735
|
children: jsxs("div", {
|
|
3747
3736
|
style: {
|
|
3748
3737
|
position: 'absolute',
|
|
@@ -3750,22 +3739,22 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3750
3739
|
left: calendarIconPx + "px"
|
|
3751
3740
|
},
|
|
3752
3741
|
children: [jsx(CustomTooltip, {
|
|
3753
|
-
title: !open && t('timeslider-marker-placement'),
|
|
3754
3742
|
slotProps: {
|
|
3755
3743
|
transition: {
|
|
3756
3744
|
exit: false
|
|
3757
3745
|
}
|
|
3758
3746
|
},
|
|
3747
|
+
title: !open && t('timeslider-marker-placement'),
|
|
3759
3748
|
children: jsx(CustomToggleButton, {
|
|
3760
|
-
sx: style,
|
|
3761
|
-
selected: open,
|
|
3762
|
-
variant: "flat",
|
|
3763
3749
|
onClick: function onClick() {
|
|
3764
3750
|
return setOpen(!open);
|
|
3765
3751
|
},
|
|
3766
3752
|
ref: function ref(_ref2) {
|
|
3767
3753
|
setAnchorEl(_ref2);
|
|
3768
3754
|
},
|
|
3755
|
+
selected: open,
|
|
3756
|
+
sx: style,
|
|
3757
|
+
variant: "flat",
|
|
3769
3758
|
children: jsx(CalendarToday, {
|
|
3770
3759
|
style: {
|
|
3771
3760
|
marginRight: '0px'
|
|
@@ -3773,24 +3762,24 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3773
3762
|
})
|
|
3774
3763
|
})
|
|
3775
3764
|
}), jsx(Popper, {
|
|
3765
|
+
anchorEl: anchorEl,
|
|
3766
|
+
"data-testid": "dateTimePickerPopOver",
|
|
3767
|
+
open: open,
|
|
3768
|
+
placement: "top-start",
|
|
3776
3769
|
sx: {
|
|
3777
3770
|
zIndex: 10
|
|
3778
3771
|
},
|
|
3779
|
-
placement: "top-start",
|
|
3780
|
-
open: open,
|
|
3781
|
-
"data-testid": "dateTimePickerPopOver",
|
|
3782
|
-
anchorEl: anchorEl,
|
|
3783
3772
|
children: jsx(MarkerTimeSelector, {
|
|
3784
|
-
dataStartTime: dataStartTime,
|
|
3785
3773
|
dataEndTime: dataEndTime,
|
|
3786
|
-
|
|
3774
|
+
dataStartTime: dataStartTime,
|
|
3775
|
+
onCancel: function onCancel() {
|
|
3776
|
+
return setOpen(false);
|
|
3777
|
+
},
|
|
3787
3778
|
onSelect: function onSelect(newTime) {
|
|
3788
3779
|
setOpen(false);
|
|
3789
3780
|
_onSelect(newTime);
|
|
3790
3781
|
},
|
|
3791
|
-
|
|
3792
|
-
return setOpen(false);
|
|
3793
|
-
}
|
|
3782
|
+
value: selectedTime
|
|
3794
3783
|
})
|
|
3795
3784
|
})]
|
|
3796
3785
|
})
|
|
@@ -3826,13 +3815,13 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3826
3815
|
var theme = useTheme();
|
|
3827
3816
|
var _useCanvasTarget = useCanvasTarget('mousedown'),
|
|
3828
3817
|
node = _useCanvasTarget[1];
|
|
3829
|
-
var _React$useState =
|
|
3818
|
+
var _React$useState = React.useState('auto'),
|
|
3830
3819
|
cursorStyle = _React$useState[0],
|
|
3831
3820
|
setCursorStyle = _React$useState[1];
|
|
3832
|
-
var _React$useState2 =
|
|
3821
|
+
var _React$useState2 = React.useState(false),
|
|
3833
3822
|
mouseDownInTimeBox = _React$useState2[0],
|
|
3834
3823
|
setMouseDownInTimeBox = _React$useState2[1];
|
|
3835
|
-
var _React$useState3 =
|
|
3824
|
+
var _React$useState3 = React.useState(0),
|
|
3836
3825
|
canvasWidth = _React$useState3[0],
|
|
3837
3826
|
setCanvasWidth = _React$useState3[1];
|
|
3838
3827
|
var isAnimating = linkedMapAnimationInfo == null ? void 0 : linkedMapAnimationInfo.isAnimating;
|
|
@@ -3859,7 +3848,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3859
3848
|
};
|
|
3860
3849
|
var mouseDownX = useRef(0);
|
|
3861
3850
|
var unfilteredSelectedTimePxAtMouseDown = useRef(0);
|
|
3862
|
-
|
|
3851
|
+
React.useEffect(function () {
|
|
3863
3852
|
var handleMouseUp = function handleMouseUp() {
|
|
3864
3853
|
mouseDownInTimeBox ? setCursorStyle('grab') : setCursorStyle('auto');
|
|
3865
3854
|
setMouseDownInTimeBox(false);
|
|
@@ -3892,36 +3881,35 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3892
3881
|
var currentTimeBoxWidth = getTimeBoxWidth(span);
|
|
3893
3882
|
var calendarIconPx = timePx - currentTimeBoxWidth / 2 + CALENDAR_ICON_LEFT_SPACING;
|
|
3894
3883
|
return jsxs(Box$1, {
|
|
3895
|
-
"data-testid": "timeSliderTimeBox",
|
|
3896
3884
|
className: "timeSliderTimeBox",
|
|
3885
|
+
"data-testid": "timeSliderTimeBox",
|
|
3897
3886
|
sx: {
|
|
3898
3887
|
height: '24px',
|
|
3899
3888
|
cursor: cursorStyle
|
|
3900
3889
|
},
|
|
3901
3890
|
children: [jsx(CanvasComponent, {
|
|
3902
|
-
|
|
3903
|
-
onMouseMove: function onMouseMove$1(x, y, event, width) {
|
|
3891
|
+
onMouseDown: function onMouseDown$1(x, y, width) {
|
|
3904
3892
|
if (!unfilteredSelectedTime) {
|
|
3905
3893
|
return;
|
|
3906
3894
|
}
|
|
3907
|
-
|
|
3895
|
+
onMouseDown(x, width, unfilteredSelectedTime, centerTime, secondsPerPx, isTimeBoxArea, setCursorStyle, setMouseDownInTimeBox);
|
|
3908
3896
|
},
|
|
3909
|
-
|
|
3897
|
+
onMouseMove: function onMouseMove$1(x, y, event, width) {
|
|
3910
3898
|
if (!unfilteredSelectedTime) {
|
|
3911
3899
|
return;
|
|
3912
3900
|
}
|
|
3913
|
-
|
|
3901
|
+
onMouseMove(x, width, unfilteredSelectedTime, centerTime, secondsPerPx, mouseDownInTimeBox, isTimeBoxArea, setCursorStyle);
|
|
3914
3902
|
},
|
|
3915
3903
|
onRenderCanvas: function onRenderCanvas(ctx, width, height) {
|
|
3916
3904
|
setCanvasWidth(width);
|
|
3917
3905
|
var filteredTime = getFilteredTime(unfilteredSelectedTime, timeStep, dataStartTime, dataEndTime);
|
|
3918
3906
|
renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, filteredTime, secondsPerPx, span, isAutoUpdating);
|
|
3919
|
-
}
|
|
3907
|
+
},
|
|
3908
|
+
ref: node
|
|
3920
3909
|
}), jsx(CalendarButton, {
|
|
3921
3910
|
calendarIconPx: calendarIconPx,
|
|
3922
|
-
dataStartTime: dataStartTime,
|
|
3923
3911
|
dataEndTime: dataEndTime,
|
|
3924
|
-
|
|
3912
|
+
dataStartTime: dataStartTime,
|
|
3925
3913
|
onSelect: function onSelect(newSelectedTime) {
|
|
3926
3914
|
if (newSelectedTime) {
|
|
3927
3915
|
onCalendarSelect(newSelectedTime);
|
|
@@ -3929,7 +3917,8 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3929
3917
|
onSetCenterTime(newSelectedTime - filteredTime + centerTime);
|
|
3930
3918
|
}
|
|
3931
3919
|
}
|
|
3932
|
-
}
|
|
3920
|
+
},
|
|
3921
|
+
selectedTime: filteredTime
|
|
3933
3922
|
})]
|
|
3934
3923
|
});
|
|
3935
3924
|
};
|
|
@@ -3955,4 +3944,4 @@ var DemoWrapper = function DemoWrapper(_ref2) {
|
|
|
3955
3944
|
});
|
|
3956
3945
|
};
|
|
3957
3946
|
|
|
3958
|
-
export { AUTO_MOVE_AREA_PADDING, AnimationLength, AnimationLengthButton, AutoUpdateButton, BackwardForwardStepButton, ControlButtons, DRAG_AREA_WIDTH, DemoWrapper, HideSliderButton, NowButton, OptionsMenu, OptionsMenuButton, PlayButton, Scale, SpeedButton, TIME_SLIDER_LEGEND_HEIGHT, TIME_SLIDER_NAMESPACE, TimeInMinutes, TimeSlider, TimeSliderButtons, TimeSliderClock, TimeSliderCurrentTimeBox, TimeSliderLegend, TimeSliderMenu, TimeSpanButton, TimeStepButton, calculateMouseTimeAndCheckBounds, convertStringTimeToUnix, defaultAnimationDelayAtStart, defaultDelay, defaultSecondsPerPx, defaultTimeSpan, defaultTimeStep, getAutoMoveAreaWidth, getFilteredTime, getFundamentalScale, getLargestTimeUnit, getNewCenterOfFixedPointZoom, getPixelsBetweenViewportAndTimesliderOnLeft, getPositions, getScaleFromSpan, getSpeedDelay, getTimeBoxWidth, getTimeSliderLegendElement, getTimeSliderLegendId, handleSetNowEvent, isDraggingEndWithinBounds, isDraggingStartWithinBounds, isInsideAnimationArea, isLeftAnimationIconArea, isRightAnimationIconArea, isSelectedTimeIconArea, marks$1 as marks, minutesToDescribedDuration, moveRelativeToTimePoint, moveSelectedTimePx, onsetNewDateDebounced, pixelToTimestamp, roundWithTimeStep, scaleToSecondsPerPx, scalingCoefficient, secondsPerPxFromCanvasWidth, secondsPerPxToScale, secondsPerPxValues, setNextTimeStep, setPreviousTimeStep,
|
|
3947
|
+
export { AUTO_MOVE_AREA_PADDING, AnimationLength, AnimationLengthButton, AutoUpdateButton, BackwardForwardStepButton, ControlButtons, DRAG_AREA_WIDTH, DemoWrapper, HideSliderButton, NowButton, OptionsMenu, OptionsMenuButton, PlayButton, Scale, SpeedButton, TIME_SLIDER_LEGEND_HEIGHT, TIME_SLIDER_NAMESPACE, TimeInMinutes, TimeSlider, TimeSliderButtons, TimeSliderClock, TimeSliderCurrentTimeBox, TimeSliderLegend, TimeSliderMenu, TimeSpanButton, TimeStepButton, calculateMouseTimeAndCheckBounds, convertStringTimeToUnix, defaultAnimationDelayAtStart, defaultDelay, defaultSecondsPerPx, defaultTimeSpan, defaultTimeStep, getAutoMoveAreaWidth, getFilteredTime, getFundamentalScale, getLargestTimeUnit, getNewCenterOfFixedPointZoom, getPixelsBetweenViewportAndTimesliderOnLeft, getPositions, getScaleFromSpan, getSpeedDelay, getTimeBoxWidth, getTimeSliderLegendElement, getTimeSliderLegendId, handleSetNowEvent, isDraggingEndWithinBounds, isDraggingStartWithinBounds, isInsideAnimationArea, isLeftAnimationIconArea, isRightAnimationIconArea, isSelectedTimeIconArea, marks$1 as marks, minutesToDescribedDuration, moveRelativeToTimePoint, moveSelectedTimePx, onsetNewDateDebounced, pixelToTimestamp, roundWithTimeStep, scaleToSecondsPerPx, scalingCoefficient, secondsPerPxFromCanvasWidth, secondsPerPxToScale, secondsPerPxValues, setNextTimeStep, setPreviousTimeStep, spanToScale, speedFactors, timeBoxGeom, timeSliderLegendDefaultProps, timeSliderUtils, timeValues, timesliderTranslations, timestampToPixel, timestampToPixelEdges, useCanvasTarget };
|