@opengeoweb/time-slider 16.0.0 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +547 -128
- package/package.json +4 -4
- package/src/index.d.ts +0 -5
- package/src/lib/Providers/Providers.d.ts +0 -8
- package/src/lib/Providers/index.d.ts +0 -1
- package/src/lib/components/TimeSlider/TimeSlider.d.ts +0 -16
- package/src/lib/components/TimeSlider/TimeSlider.spec.d.ts +0 -1
- package/src/lib/components/TimeSlider/TimeSlider.stories.d.ts +0 -7
- package/src/lib/components/TimeSlider/changeTimeFunctions.d.ts +0 -14
- package/src/lib/components/TimeSlider/changeTimeFunctions.spec.d.ts +0 -1
- package/src/lib/components/TimeSlider/index.d.ts +0 -4
- package/src/lib/components/TimeSlider/timeSliderEffects.d.ts +0 -2
- package/src/lib/components/TimeSlider/timeSliderUtils.d.ts +0 -129
- package/src/lib/components/TimeSlider/timeSliderUtils.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +0 -12
- package/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/AutoUpdateButton/AutoUpdateButton.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/AutoUpdateButton/AutoUpdateButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/ControlButtons/ControlButtons.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/HideSliderButton/HideSliderButton.d.ts +0 -6
- package/src/lib/components/TimeSliderButtons/HideSliderButton/HideSliderButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/NowButton/NowButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/NowButton/NowButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenu.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +0 -11
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/OptionsMenuButton/index.d.ts +0 -2
- package/src/lib/components/TimeSliderButtons/PlayButton/PlayButton.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/PlayButton/PlayButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/SpeedButton/SpeedButton.d.ts +0 -6
- package/src/lib/components/TimeSliderButtons/SpeedButton/SpeedButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.d.ts +0 -10
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSliderButtons.stories.d.ts +0 -8
- package/src/lib/components/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.d.ts +0 -24
- package/src/lib/components/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.d.ts +0 -17
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButton.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButtonCustomSelect.d.ts +0 -7
- package/src/lib/components/TimeSliderButtons/TimeSpanButton/TimeSpanButtonCustomSelect.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.d.ts +0 -11
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderButtons/TimeStepButton/TimeStepButton.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderButtons/index.d.ts +0 -13
- package/src/lib/components/TimeSliderCurrentTimeBox/CalendarButton/CalendarButton.d.ts +0 -10
- package/src/lib/components/TimeSliderCurrentTimeBox/CalendarButton/CalendarButton.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/MarkerTimeSelector/MarkerTimeSelector.d.ts +0 -24
- package/src/lib/components/TimeSliderCurrentTimeBox/MarkerTimeSelector/MarkerTimeSelector.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBox.d.ts +0 -20
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBox.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxMouseEvents.d.ts +0 -2
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxMouseEvents.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxRenderFunctions.d.ts +0 -3
- package/src/lib/components/TimeSliderCurrentTimeBox/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.d.ts +0 -35
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/TimeSliderLegend.stories.d.ts +0 -9
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawBackground.d.ts +0 -4
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawBackground.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawCurrentTime.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawNeedle.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeScale.d.ts +0 -7
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeScale.spec.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/drawFunctions/drawTimeSliderLegend.d.ts +0 -2
- package/src/lib/components/TimeSliderLegend/drawFunctions/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/index.d.ts +0 -1
- package/src/lib/components/TimeSliderLegend/timeSliderLegendUtils.d.ts +0 -37
- package/src/lib/components/TimeSliderLegend/timeSliderLegenedUtils.spec.d.ts +0 -1
- package/src/lib/index.d.ts +0 -5
- package/src/lib/utils/i18n.d.ts +0 -6
package/index.esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
1
|
import { Grid, useTheme, Box, Typography, Menu, MenuItem, CardHeader, FormControl, TextField, Select, Popper, Paper, Stack, InputAdornment, ClickAwayListener } from '@mui/material';
|
|
3
2
|
import React, { useState, useRef, useEffect, createElement } from 'react';
|
|
4
3
|
import { dateUtils, safelyInitI18nForTestsAndStories, CustomIconButton, CustomTooltip, CanvasComponent, renderCounter, CustomToggleButton } from '@opengeoweb/shared';
|
|
@@ -6,6 +5,7 @@ import { debounce, throttle } from 'lodash';
|
|
|
6
5
|
import { ChevronDown, ChevronUp, dragHandlePath, Edit, Animation, AutoUpdateActive, AutoUpdateInActive, StepForward, StepBackward, Now, Pause, Play, Speed, Clock, FastForward, Options, CalendarToday, ThemeWrapper, lightTheme, darkTheme } from '@opengeoweb/theme';
|
|
7
6
|
import i18n from 'i18next';
|
|
8
7
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import { Box as Box$1 } from '@mui/system';
|
|
10
10
|
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
11
11
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
@@ -259,8 +259,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
var Scale
|
|
263
|
-
(function (Scale) {
|
|
262
|
+
var Scale = /*#__PURE__*/function (Scale) {
|
|
264
263
|
Scale[Scale["Minutes5"] = 0] = "Minutes5";
|
|
265
264
|
Scale[Scale["Hour"] = 1] = "Hour";
|
|
266
265
|
Scale[Scale["Hours3"] = 2] = "Hours3";
|
|
@@ -271,9 +270,9 @@ var Scale;
|
|
|
271
270
|
Scale[Scale["Month"] = 7] = "Month";
|
|
272
271
|
Scale[Scale["Months3"] = 8] = "Months3";
|
|
273
272
|
Scale[Scale["Year"] = 9] = "Year";
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
return Scale;
|
|
274
|
+
}({});
|
|
275
|
+
var AnimationLength = /*#__PURE__*/function (AnimationLength) {
|
|
277
276
|
AnimationLength[AnimationLength["Minutes15"] = 15] = "Minutes15";
|
|
278
277
|
AnimationLength[AnimationLength["Minutes30"] = 30] = "Minutes30";
|
|
279
278
|
AnimationLength[AnimationLength["Hours1"] = 60] = "Hours1";
|
|
@@ -282,15 +281,18 @@ var AnimationLength;
|
|
|
282
281
|
AnimationLength[AnimationLength["Hours6"] = 360] = "Hours6";
|
|
283
282
|
AnimationLength[AnimationLength["Hours12"] = 720] = "Hours12";
|
|
284
283
|
AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
|
|
285
|
-
|
|
284
|
+
return AnimationLength;
|
|
285
|
+
}({});
|
|
286
286
|
/**
|
|
287
287
|
* In this Map collection all fundamental scales
|
|
288
288
|
* (Scale.Minutes5 ... Scale.Year) are mapped with their corresponding
|
|
289
289
|
* secondsPerPx numbers.
|
|
290
290
|
* @returns a Map including information explained above
|
|
291
291
|
*/
|
|
292
|
+
|
|
292
293
|
var secondsPerPxToScale = new Map([[2.5, Scale.Minutes5], [30, Scale.Hour], [3 * 30, Scale.Hours3], [6 * 30, Scale.Hours6], [24 * 30, Scale.Day], [7 * 24 * 30, Scale.Week], [14 * 24 * 30, Scale.Weeks2], [30 * 24 * 30, Scale.Month], [90 * 24 * 30, Scale.Months3], [365 * 24 * 30, Scale.Year]]);
|
|
293
294
|
var spanToScale = new Map([[5 * 60, Scale.Minutes5], [60 * 60, Scale.Hour], [3 * 60 * 60, Scale.Hours3], [6 * 60 * 60, Scale.Hours6], [24 * 60 * 60, Scale.Day], [7 * 24 * 60 * 60, Scale.Week], [14 * 24 * 60 * 60, Scale.Weeks2], [30 * 24 * 60 * 60, Scale.Month], [90 * 24 * 60 * 60, Scale.Months3], [365 * 24 * 60 * 60, Scale.Year]]);
|
|
295
|
+
|
|
294
296
|
/**
|
|
295
297
|
* Creates a reverse mapping of scales to their corresponding secondsPerPx
|
|
296
298
|
* values to make it easier in some parts GeoWeb to fetch a secondsPerpx for
|
|
@@ -298,6 +300,7 @@ var spanToScale = new Map([[5 * 60, Scale.Minutes5], [60 * 60, Scale.Hour], [3 *
|
|
|
298
300
|
* @returns an Object, where names are fundamental scale values (0 - 7) and
|
|
299
301
|
* values are their corresponding secondsPerPx numbers.
|
|
300
302
|
*/
|
|
303
|
+
|
|
301
304
|
var scaleToSecondsPerPx = Object.fromEntries(Array.from(secondsPerPxToScale.entries()).map(function (_ref) {
|
|
302
305
|
var key = _ref[0],
|
|
303
306
|
value = _ref[1];
|
|
@@ -315,6 +318,7 @@ var timestampToPixel = function timestampToPixel(timestamp, centerTime, widthPx,
|
|
|
315
318
|
var pixelToTimestamp = function pixelToTimestamp(timePx, centerTime, widthPx, secondsPerPx) {
|
|
316
319
|
return centerTime - (widthPx / 2 - timePx) * secondsPerPx;
|
|
317
320
|
};
|
|
321
|
+
|
|
318
322
|
/**
|
|
319
323
|
* This function creates and returns an array where there is secondsPerPx
|
|
320
324
|
* number of the data set added for a data scale (secondsPerPx)
|
|
@@ -324,6 +328,7 @@ var pixelToTimestamp = function pixelToTimestamp(timePx, centerTime, widthPx, se
|
|
|
324
328
|
* The secondsPerPx number for a data scale is included
|
|
325
329
|
* contrary to secondsPerPxToScale.
|
|
326
330
|
*/
|
|
331
|
+
|
|
327
332
|
var secondsPerPxValues = function secondsPerPxValues(secondsPerPx) {
|
|
328
333
|
var sortedSecondsPerPx = [].concat(secondsPerPxToScale).map(function (value) {
|
|
329
334
|
return Number(value[0]);
|
|
@@ -341,6 +346,7 @@ var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTi
|
|
|
341
346
|
var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
|
|
342
347
|
return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
|
|
343
348
|
};
|
|
349
|
+
|
|
344
350
|
/**
|
|
345
351
|
* Move the time slider such that a given time point (timePoint)
|
|
346
352
|
* is at a given pixel width (timePointPx).
|
|
@@ -349,6 +355,7 @@ var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTi
|
|
|
349
355
|
var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
|
|
350
356
|
return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
|
|
351
357
|
};
|
|
358
|
+
|
|
352
359
|
/** This reusable custom hook tells whether given pointer event targets current canvas node.
|
|
353
360
|
* Example:
|
|
354
361
|
*
|
|
@@ -357,11 +364,13 @@ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePo
|
|
|
357
364
|
* return isAllowedCanvasNodePointed ? (<CanvasComponent ref={nodeRef}>Component with ref</CanvasComponent>) : (<CanvasComponent>Component with NO ref</CanvasComponent>);
|
|
358
365
|
* ...
|
|
359
366
|
*/
|
|
367
|
+
|
|
360
368
|
var useCanvasTarget = function useCanvasTarget(eventType) {
|
|
361
369
|
var nodeRef = React.useRef(null);
|
|
362
370
|
var _React$useState = React.useState(false),
|
|
363
371
|
isTargetNode = _React$useState[0],
|
|
364
372
|
setIsTargetNode = _React$useState[1];
|
|
373
|
+
|
|
365
374
|
// Check if pointer event targets current node element
|
|
366
375
|
var pointerEventListener = React.useCallback(function (event) {
|
|
367
376
|
setIsTargetNode(nodeRef.current.canvas ? nodeRef.current.canvas.isEqualNode(event.target) : false);
|
|
@@ -372,6 +381,7 @@ var useCanvasTarget = function useCanvasTarget(eventType) {
|
|
|
372
381
|
return document.removeEventListener(eventType, pointerEventListener);
|
|
373
382
|
};
|
|
374
383
|
}, [eventType, pointerEventListener]); // Only add/remove event listener when listener really changes, that is, NOT necessarily between every re-render.
|
|
384
|
+
|
|
375
385
|
return [isTargetNode, nodeRef];
|
|
376
386
|
};
|
|
377
387
|
var timeBoxGeom = {
|
|
@@ -387,15 +397,16 @@ var AUTO_MOVE_AREA_PADDING = 1;
|
|
|
387
397
|
var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
|
|
388
398
|
return (scale === Scale.Year ? timeBoxGeom.largeWidth + timeBoxGeom.iconWidth : timeBoxGeom.smallWidth + timeBoxGeom.iconWidth) / 2 + AUTO_MOVE_AREA_PADDING;
|
|
389
399
|
};
|
|
390
|
-
var TimeInMinutes
|
|
391
|
-
(function (TimeInMinutes) {
|
|
400
|
+
var TimeInMinutes = /*#__PURE__*/function (TimeInMinutes) {
|
|
392
401
|
TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
|
|
393
402
|
TimeInMinutes[TimeInMinutes["MONTH"] = 43200] = "MONTH";
|
|
394
403
|
TimeInMinutes[TimeInMinutes["WEEK"] = 10080] = "WEEK";
|
|
395
404
|
TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
|
|
396
405
|
TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
|
|
397
406
|
TimeInMinutes[TimeInMinutes["MINUTE"] = 1] = "MINUTE";
|
|
398
|
-
|
|
407
|
+
return TimeInMinutes;
|
|
408
|
+
}({});
|
|
409
|
+
|
|
399
410
|
/**
|
|
400
411
|
*
|
|
401
412
|
* @param minutes
|
|
@@ -448,6 +459,7 @@ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
|
|
|
448
459
|
});
|
|
449
460
|
return durations.time.trim();
|
|
450
461
|
};
|
|
462
|
+
|
|
451
463
|
/**
|
|
452
464
|
* Returns the largest timeunit value divisible by minuts
|
|
453
465
|
* @param minutes
|
|
@@ -465,6 +477,7 @@ function getLargestTimeUnit(minutes) {
|
|
|
465
477
|
}
|
|
466
478
|
return TimeInMinutes.MINUTE;
|
|
467
479
|
}
|
|
480
|
+
|
|
468
481
|
// For a data scale an appropriate fundamental scale is chosen
|
|
469
482
|
// depending on secondsPerPx of data. When a time range of
|
|
470
483
|
// data is for example many months. the fundamental scale Scale.Year
|
|
@@ -473,6 +486,7 @@ function getLargestTimeUnit(minutes) {
|
|
|
473
486
|
//
|
|
474
487
|
// If a time range of data is a few weeks, Scale.Month is chosen. So, all
|
|
475
488
|
// the time range of data can be shown in the window.
|
|
489
|
+
|
|
476
490
|
var getFundamentalScale = function getFundamentalScale(secondsPerPx) {
|
|
477
491
|
if (secondsPerPx >= scaleToSecondsPerPx[Scale.Month]) {
|
|
478
492
|
return Scale.Year;
|
|
@@ -520,10 +534,12 @@ var calculateMouseTimeAndCheckBounds = function calculateMouseTimeAndCheckBounds
|
|
|
520
534
|
if (isDraggingWithinBounds) {
|
|
521
535
|
return undefined;
|
|
522
536
|
}
|
|
537
|
+
|
|
523
538
|
// eslint-disable-next-line no-param-reassign
|
|
524
539
|
tooltipPosition.current = pixelsBetweenViewportAndTimesliderOnLeft && mousePosition + pixelsBetweenViewportAndTimesliderOnLeft;
|
|
525
540
|
return pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
|
|
526
541
|
};
|
|
542
|
+
|
|
527
543
|
// default values
|
|
528
544
|
var defaultAnimationDelayAtStart = 250;
|
|
529
545
|
var defaultDelay = 1000; // [ms]
|
|
@@ -531,6 +547,7 @@ var defaultTimeStep = 60;
|
|
|
531
547
|
var defaultSecondsPerPx = 80;
|
|
532
548
|
var defaultTimeSpan = 24 * 3600;
|
|
533
549
|
var speedFactors = [0.1, 0.2, 0.5, 1, 2, 4, 8, 16]; // Declares available animation speed multipliers for default delay
|
|
550
|
+
|
|
534
551
|
var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
|
|
535
552
|
var adjustedTimeStep = timeStep * 60;
|
|
536
553
|
if (!type || type === 'round') {
|
|
@@ -544,9 +561,11 @@ var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
|
|
|
544
561
|
}
|
|
545
562
|
return undefined;
|
|
546
563
|
};
|
|
564
|
+
|
|
547
565
|
/**
|
|
548
566
|
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
549
567
|
*/
|
|
568
|
+
|
|
550
569
|
var getSpeedDelay = function getSpeedDelay(speedFactor) {
|
|
551
570
|
return defaultDelay / speedFactor;
|
|
552
571
|
};
|
|
@@ -570,9 +589,9 @@ var timeSliderLegendDefaultProps = {
|
|
|
570
589
|
var timeSliderUtils = /*#__PURE__*/Object.freeze({
|
|
571
590
|
__proto__: null,
|
|
572
591
|
AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
592
|
+
AnimationLength: AnimationLength,
|
|
593
|
+
Scale: Scale,
|
|
594
|
+
TimeInMinutes: TimeInMinutes,
|
|
576
595
|
calculateMouseTimeAndCheckBounds: calculateMouseTimeAndCheckBounds,
|
|
577
596
|
defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
|
|
578
597
|
defaultDelay: defaultDelay,
|
|
@@ -620,6 +639,7 @@ var timeSliderUtils = /*#__PURE__*/Object.freeze({
|
|
|
620
639
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
621
640
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
622
641
|
* */
|
|
642
|
+
|
|
623
643
|
var onsetNewDateDebounced = debounce(function (dateToSet, onSetNewDate) {
|
|
624
644
|
onSetNewDate(dateToSet);
|
|
625
645
|
}, 4, {
|
|
@@ -643,6 +663,7 @@ var setNextTimeStep = function setNextTimeStep(timeStep, currentTime, dataEndTim
|
|
|
643
663
|
var selectedTimeString = dateUtils.fromUnix(newTime).toISOString();
|
|
644
664
|
onSetNewDate(selectedTimeString);
|
|
645
665
|
};
|
|
666
|
+
|
|
646
667
|
/**
|
|
647
668
|
* updates unfiltered selected time and moves selected time a given distance
|
|
648
669
|
* in pixels. Unfiltered selected time can be outside data data limits, but
|
|
@@ -662,6 +683,7 @@ function getFilteredTime(unfilteredTime, timeStep, dataStartTime, dataEndTime) {
|
|
|
662
683
|
var maxTime = Math.max(roundedTime, dataStartTime);
|
|
663
684
|
return Math.min(maxTime, dataEndTime);
|
|
664
685
|
}
|
|
686
|
+
|
|
665
687
|
/** Reusable business logic for how to handle events that set time to now (closest).
|
|
666
688
|
* Used in NowButton and TimeSliderLegend.
|
|
667
689
|
*/
|
|
@@ -698,6 +720,7 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
|
|
|
698
720
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
699
721
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
700
722
|
* */
|
|
723
|
+
|
|
701
724
|
var useToggleTimesliderVisibility = function useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider) {
|
|
702
725
|
React.useEffect(function () {
|
|
703
726
|
var handleKeyDown = function handleKeyDown(event) {
|
|
@@ -755,6 +778,7 @@ var useMoveTimeWithKeyboard = function useMoveTimeWithKeyboard(mapIsActive, time
|
|
|
755
778
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
756
779
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
757
780
|
* */
|
|
781
|
+
|
|
758
782
|
var TIME_SLIDER_NAMESPACE = 'timeslider';
|
|
759
783
|
var initTimesliderI18n = function initTimesliderI18n() {
|
|
760
784
|
safelyInitI18nForTestsAndStories(i18n, TIME_SLIDER_NAMESPACE, [{
|
|
@@ -766,19 +790,37 @@ var useTimesliderTranslation = function useTimesliderTranslation() {
|
|
|
766
790
|
return useTranslation(TIME_SLIDER_NAMESPACE);
|
|
767
791
|
};
|
|
768
792
|
|
|
793
|
+
/* *
|
|
794
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
795
|
+
* you may not use this file except in compliance with the License.
|
|
796
|
+
* You may obtain a copy of the License at
|
|
797
|
+
*
|
|
798
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
799
|
+
*
|
|
800
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
801
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
802
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
803
|
+
* See the License for the specific language governing permissions and
|
|
804
|
+
* limitations under the License.
|
|
805
|
+
*
|
|
806
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
807
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
808
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
809
|
+
* */
|
|
810
|
+
|
|
769
811
|
var HideSliderButtonComponent = function HideSliderButtonComponent(_ref) {
|
|
770
812
|
var isVisible = _ref.isVisible,
|
|
771
813
|
toggleTimeSliderIsVisible = _ref.toggleTimeSliderIsVisible;
|
|
772
814
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
773
815
|
t = _useTimesliderTransla.t;
|
|
774
|
-
return jsx(CustomIconButton, {
|
|
816
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
775
817
|
"data-testid": "hideTimeSliderButton",
|
|
776
818
|
onClick: function onClick() {
|
|
777
819
|
toggleTimeSliderIsVisible(!isVisible);
|
|
778
820
|
},
|
|
779
821
|
tooltipTitle: isVisible ? t('timeslider-hide') : t('timeslider-show'),
|
|
780
822
|
variant: "tool",
|
|
781
|
-
children: isVisible ? jsx(ChevronDown, {}) : jsx(ChevronUp, {})
|
|
823
|
+
children: isVisible ? /*#__PURE__*/jsx(ChevronDown, {}) : /*#__PURE__*/jsx(ChevronUp, {})
|
|
782
824
|
});
|
|
783
825
|
};
|
|
784
826
|
var HideSliderButton = /*#__PURE__*/React.memo(HideSliderButtonComponent);
|
|
@@ -800,6 +842,8 @@ var HideSliderButton = /*#__PURE__*/React.memo(HideSliderButtonComponent);
|
|
|
800
842
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
801
843
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
802
844
|
* */
|
|
845
|
+
|
|
846
|
+
|
|
803
847
|
/**
|
|
804
848
|
* @param x The pin location
|
|
805
849
|
* @param selectedTimePx The selected px
|
|
@@ -867,6 +911,24 @@ function getPositions(width, unfilteredSelectedTime, centerTime, secondsPerPx, s
|
|
|
867
911
|
};
|
|
868
912
|
}
|
|
869
913
|
|
|
914
|
+
/* *
|
|
915
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
916
|
+
* you may not use this file except in compliance with the License.
|
|
917
|
+
* You may obtain a copy of the License at
|
|
918
|
+
*
|
|
919
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
920
|
+
*
|
|
921
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
922
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
923
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
924
|
+
* See the License for the specific language governing permissions and
|
|
925
|
+
* limitations under the License.
|
|
926
|
+
*
|
|
927
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
928
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
929
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
930
|
+
* */
|
|
931
|
+
|
|
870
932
|
var TimeSlider = function TimeSlider(_ref) {
|
|
871
933
|
var buttons = _ref.buttons,
|
|
872
934
|
timeBox = _ref.timeBox,
|
|
@@ -885,11 +947,13 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
885
947
|
onToggleTimeSlider = _ref$onToggleTimeSlid === void 0 ? function () {} : _ref$onToggleTimeSlid;
|
|
886
948
|
// set up visibility toggle
|
|
887
949
|
useToggleTimesliderVisibility(mapIsActive, isVisible, onToggleTimeSlider);
|
|
950
|
+
|
|
888
951
|
// set up movement with keyboard shortcuts
|
|
889
952
|
useMoveTimeWithKeyboard(mapIsActive, timeStep, dataStartTime, dataEndTime, onSetNewDate, onSetCenterTime, selectedTime);
|
|
953
|
+
|
|
890
954
|
// timeBox, buttons and legend are created in TimeSliderConnect.tsx
|
|
891
955
|
// these components will always be created as TimeSlider never runs in isolation from the store
|
|
892
|
-
return isVisible ? jsxs(Grid, {
|
|
956
|
+
return isVisible ? /*#__PURE__*/jsxs(Grid, {
|
|
893
957
|
container: true,
|
|
894
958
|
"data-testid": "timeSlider",
|
|
895
959
|
sx: {
|
|
@@ -906,7 +970,7 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
906
970
|
paddingRight: '5%'
|
|
907
971
|
}
|
|
908
972
|
},
|
|
909
|
-
children: [jsx(Grid, {
|
|
973
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
910
974
|
sx: {
|
|
911
975
|
gridArea: 'timebox',
|
|
912
976
|
zIndex: 99,
|
|
@@ -914,35 +978,35 @@ var TimeSlider = function TimeSlider(_ref) {
|
|
|
914
978
|
overflow: 'hidden'
|
|
915
979
|
},
|
|
916
980
|
children: timeBox
|
|
917
|
-
}), jsx(Grid, {
|
|
981
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
918
982
|
sx: {
|
|
919
983
|
gridArea: 'buttons'
|
|
920
984
|
},
|
|
921
985
|
children: buttons
|
|
922
|
-
}), jsx(Grid, {
|
|
986
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
923
987
|
sx: {
|
|
924
988
|
gridArea: 'timelegend'
|
|
925
989
|
},
|
|
926
990
|
children: legend
|
|
927
|
-
}), jsx(Grid, {
|
|
991
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
928
992
|
sx: {
|
|
929
993
|
gridArea: 'toggle',
|
|
930
994
|
paddingLeft: 1,
|
|
931
995
|
lineHeight: 0
|
|
932
996
|
},
|
|
933
|
-
children: jsx(HideSliderButton, {
|
|
997
|
+
children: /*#__PURE__*/jsx(HideSliderButton, {
|
|
934
998
|
isVisible: isVisible,
|
|
935
999
|
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
936
1000
|
})
|
|
937
1001
|
})]
|
|
938
|
-
}) : jsx(Grid, {
|
|
1002
|
+
}) : /*#__PURE__*/jsx(Grid, {
|
|
939
1003
|
container: true,
|
|
940
1004
|
sx: {
|
|
941
1005
|
paddingRight: 1,
|
|
942
1006
|
alignItems: 'center',
|
|
943
1007
|
justifyContent: 'flex-end'
|
|
944
1008
|
},
|
|
945
|
-
children: jsx(HideSliderButton, {
|
|
1009
|
+
children: /*#__PURE__*/jsx(HideSliderButton, {
|
|
946
1010
|
isVisible: isVisible,
|
|
947
1011
|
toggleTimeSliderIsVisible: onToggleTimeSlider
|
|
948
1012
|
})
|
|
@@ -1157,6 +1221,7 @@ var roundByUnitOfTime = function roundByUnitOfTime(timeUnix, unit, roundUp) {
|
|
|
1157
1221
|
}
|
|
1158
1222
|
return dateUtils.unix(_timeStartOfPassedUnit4);
|
|
1159
1223
|
}
|
|
1224
|
+
|
|
1160
1225
|
// Default unit === 'year'
|
|
1161
1226
|
var timeStartOfPassedUnit = dateUtils.startOfYearUTC(dateUtils.fromUnix(timeUnix));
|
|
1162
1227
|
if (roundUp) {
|
|
@@ -1174,12 +1239,14 @@ var roundToNearestMultiple = function roundToNearestMultiple(timeUnix, scale, ro
|
|
|
1174
1239
|
var roundFn = roundUp ? Math.ceil : Math.floor;
|
|
1175
1240
|
return roundFn(timeUnix / stepSeconds) * stepSeconds;
|
|
1176
1241
|
};
|
|
1242
|
+
|
|
1177
1243
|
/**
|
|
1178
1244
|
* In this script starting and ending times of the time slider are rounded.
|
|
1179
1245
|
* Here it is defined what is a time unit to a start of which a rounding is
|
|
1180
1246
|
* done for each scale.
|
|
1181
1247
|
* @returns an object where there are rounding units of each scale
|
|
1182
1248
|
*/
|
|
1249
|
+
|
|
1183
1250
|
var scaleToRoundableUnit = (_scaleToRoundableUnit = {}, _scaleToRoundableUnit[Scale.Hour] = 'hour', _scaleToRoundableUnit[Scale.Day] = 'day', _scaleToRoundableUnit[Scale.Week] = 'week', _scaleToRoundableUnit[Scale.Weeks2] = 'week', _scaleToRoundableUnit[Scale.Month] = 'week', _scaleToRoundableUnit[Scale.Months3] = 'week', _scaleToRoundableUnit[Scale.Year] = 'year', _scaleToRoundableUnit);
|
|
1184
1251
|
var getRoundedStartAndEnd = function getRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, scale) {
|
|
1185
1252
|
if (scale === Scale.Minutes5 || scale === Scale.Hours3 || scale === Scale.Hours6) {
|
|
@@ -1290,12 +1357,14 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1290
1357
|
var _getRoundedStartAndEn = getRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, fundamentalScale),
|
|
1291
1358
|
roundedStart = _getRoundedStartAndEn[0],
|
|
1292
1359
|
roundedEnd = _getRoundedStartAndEn[1];
|
|
1360
|
+
|
|
1293
1361
|
// draw regular tickmarks
|
|
1294
1362
|
var ctx = context;
|
|
1295
1363
|
getTimesteps(roundedStart, roundedEnd, fundamentalScale).forEach(function (timestep) {
|
|
1296
1364
|
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
1297
1365
|
// 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
|
|
1298
1366
|
drawStepPxLine(ctx, theme, Math.floor(stepPx) + 0.5, height, fundamentalScale, timestep);
|
|
1367
|
+
|
|
1299
1368
|
// Draw the time step time as text
|
|
1300
1369
|
var timeFormat = getTimeFormat(fundamentalScale);
|
|
1301
1370
|
var timeText = dateUtils.dateToString(dateUtils.fromUnix(timestep), timeFormat);
|
|
@@ -1308,6 +1377,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1308
1377
|
drawYearScaleText(ctx, theme, timeText, stepPx, height);
|
|
1309
1378
|
}
|
|
1310
1379
|
});
|
|
1380
|
+
|
|
1311
1381
|
// draw month overlay lines
|
|
1312
1382
|
if (fundamentalScale === Scale.Week || fundamentalScale === Scale.Weeks2 || fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
1313
1383
|
var _getCustomRoundedStar = getCustomRoundedStartAndEnd(visibleTimeStart, visibleTimeEnd, Scale.Year),
|
|
@@ -1318,6 +1388,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1318
1388
|
var stepPx = timestampToPixelEdges(timestep, visibleTimeStart, visibleTimeEnd, canvasWidth);
|
|
1319
1389
|
if (fundamentalScale === Scale.Month || fundamentalScale === Scale.Months3) {
|
|
1320
1390
|
var month = dateUtils.dateToString(dateUtils.fromUnix(timestep), 'MMM');
|
|
1391
|
+
|
|
1321
1392
|
// 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
|
|
1322
1393
|
drawDateChangeLine(ctx, theme, Math.floor(stepPx) + 0.5, height);
|
|
1323
1394
|
drawTimeText(ctx, theme, stepPx, height, month, fundamentalScale);
|
|
@@ -1352,6 +1423,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
|
|
|
1352
1423
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1353
1424
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1354
1425
|
* */
|
|
1426
|
+
|
|
1355
1427
|
var drawBackground = function drawBackground(context, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, secondsPerPx, timeSliderSpan, dataStartPx, dataEndPx, currentTimePx) {
|
|
1356
1428
|
var ctx = context;
|
|
1357
1429
|
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
@@ -1359,6 +1431,7 @@ var drawBackground = function drawBackground(context, theme, visibleTimeStart, v
|
|
|
1359
1431
|
ledgendObservedBackground = _theme$palette$geoweb.ledgendObservedBackground,
|
|
1360
1432
|
legendForecastBackground = _theme$palette$geoweb.legendForecastBackground,
|
|
1361
1433
|
legendNoDataBackground = _theme$palette$geoweb.legendNoDataBackground;
|
|
1434
|
+
|
|
1362
1435
|
// top spacing
|
|
1363
1436
|
var y = 0;
|
|
1364
1437
|
var scaleToUse = timeSliderSpan ? getScaleFromSpan(timeSliderSpan) : getFundamentalScale(secondsPerPx);
|
|
@@ -1481,6 +1554,7 @@ function getColorChangeTimesteps(scale, visibleTimeStart, visibleTimeEnd) {
|
|
|
1481
1554
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1482
1555
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1483
1556
|
* */
|
|
1557
|
+
|
|
1484
1558
|
var drawCurrentTime = function drawCurrentTime(context, theme, width, height, startTime, endTime, currentTime) {
|
|
1485
1559
|
var ctx = context;
|
|
1486
1560
|
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
@@ -1518,6 +1592,7 @@ var drawCurrentTime = function drawCurrentTime(context, theme, width, height, st
|
|
|
1518
1592
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1519
1593
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1520
1594
|
* */
|
|
1595
|
+
|
|
1521
1596
|
var drawNeedle = function drawNeedle(context, theme, width, height, startTime, endTime, selectedTime) {
|
|
1522
1597
|
if (!selectedTime) {
|
|
1523
1598
|
return;
|
|
@@ -1528,6 +1603,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1528
1603
|
playerNeedlePlayerTop = _theme$palette$geoweb.playerNeedlePlayerTop,
|
|
1529
1604
|
playerTimeMarkers = _theme$palette$geoweb.playerTimeMarkers;
|
|
1530
1605
|
var selectedPx = timestampToPixelEdges(selectedTime, startTime, endTime, width);
|
|
1606
|
+
|
|
1531
1607
|
// Draw a high vertical line (needle) indicating the current or selected time
|
|
1532
1608
|
ctx.beginPath();
|
|
1533
1609
|
// 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
|
|
@@ -1539,6 +1615,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1539
1615
|
ctx.lineWidth = 1;
|
|
1540
1616
|
ctx.strokeStyle = playerNeedlePlayerTop.rgba;
|
|
1541
1617
|
ctx.stroke();
|
|
1618
|
+
|
|
1542
1619
|
// Triange connecting timebox.
|
|
1543
1620
|
ctx.beginPath();
|
|
1544
1621
|
ctx.moveTo(Math.floor(selectedPx) + 5, 0);
|
|
@@ -1566,6 +1643,7 @@ var drawNeedle = function drawNeedle(context, theme, width, height, startTime, e
|
|
|
1566
1643
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1567
1644
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1568
1645
|
* */
|
|
1646
|
+
|
|
1569
1647
|
var drawTimeSliderLegend = function drawTimeSliderLegend(context, theme, canvasWidth, height, centerTime, secondsPerPx, timeSliderSpan, selectedTimeUnix, currentTimeUnix, animationStartTime, animationEndTime, dataStartTime, dataEndTime) {
|
|
1570
1648
|
var ctx = context;
|
|
1571
1649
|
var _map = [0, canvasWidth].map(function (px) {
|
|
@@ -1588,8 +1666,27 @@ var drawTimeSliderLegend = function drawTimeSliderLegend(context, theme, canvasW
|
|
|
1588
1666
|
drawNeedle(ctx, theme, canvasWidth, height, visibleTimeStart, visibleTimeEnd, selectedTimeUnix);
|
|
1589
1667
|
};
|
|
1590
1668
|
|
|
1669
|
+
/* *
|
|
1670
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1671
|
+
* you may not use this file except in compliance with the License.
|
|
1672
|
+
* You may obtain a copy of the License at
|
|
1673
|
+
*
|
|
1674
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1675
|
+
*
|
|
1676
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1677
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1678
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1679
|
+
* See the License for the specific language governing permissions and
|
|
1680
|
+
* limitations under the License.
|
|
1681
|
+
*
|
|
1682
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1683
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1684
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1685
|
+
* */
|
|
1686
|
+
|
|
1591
1687
|
// Explanation of props can be found here:
|
|
1592
1688
|
// https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
|
|
1689
|
+
|
|
1593
1690
|
var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
1594
1691
|
var _node$current, _getTimeSliderLegendE;
|
|
1595
1692
|
var mapId = _ref.mapId,
|
|
@@ -1652,6 +1749,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1652
1749
|
var _useState7 = useState(),
|
|
1653
1750
|
lastHandledRoundedTime = _useState7[0],
|
|
1654
1751
|
setLastHandledRoundedTime = _useState7[1];
|
|
1752
|
+
|
|
1655
1753
|
// remove active drag. can happen outside canvas.
|
|
1656
1754
|
var _useState8 = useState(),
|
|
1657
1755
|
localAnimationStartTime = _useState8[0],
|
|
@@ -1673,6 +1771,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1673
1771
|
var startDraggingPosition = useRef(0);
|
|
1674
1772
|
var popperRef = useRef(null);
|
|
1675
1773
|
var isClickOrDrag = useRef();
|
|
1774
|
+
|
|
1676
1775
|
// Display unfilteredSelectedTime (already snapped to available timestep)
|
|
1677
1776
|
var displayTime = unfilteredSelectedTime;
|
|
1678
1777
|
var start = localAnimationStartTime;
|
|
@@ -1761,6 +1860,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1761
1860
|
if (timeBetweenMouseAndStartAndEnd.current === undefined) {
|
|
1762
1861
|
// to move the whole animation area we need to calculate the distance
|
|
1763
1862
|
// between the mouse position and the start and end position
|
|
1863
|
+
|
|
1764
1864
|
var _timeFromMouseToStart = mouseTimeUnix - start;
|
|
1765
1865
|
var _timeFromMouseToEnd = end - mouseTimeUnix;
|
|
1766
1866
|
timeBetweenMouseAndStartAndEnd.current = {
|
|
@@ -1881,6 +1981,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1881
1981
|
startAnimationPosition = _getPositions.startAnimationPosition,
|
|
1882
1982
|
endAnimationPosition = _getPositions.endAnimationPosition,
|
|
1883
1983
|
selectedTimePosition = _getPositions.selectedTimePosition;
|
|
1984
|
+
|
|
1884
1985
|
// start dragging selected time.
|
|
1885
1986
|
if (isSelectedTimeIconArea(x, selectedTimePosition, DRAG_AREA_WIDTH)) {
|
|
1886
1987
|
setCursorStyle('grabbing');
|
|
@@ -1890,6 +1991,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1890
1991
|
if (reduxAnimationStartTime && reduxAnimationEndTime) {
|
|
1891
1992
|
var pixelsBetweenOnLeft = getPixelsBetweenViewportAndTimesliderOnLeft(mapId);
|
|
1892
1993
|
tooltipPosition.current = pixelsBetweenOnLeft ? x + pixelsBetweenOnLeft : x;
|
|
1994
|
+
|
|
1893
1995
|
// start dragging either marker
|
|
1894
1996
|
if (isLeftAnimationIconArea(x, startAnimationPosition, DRAG_AREA_WIDTH)) {
|
|
1895
1997
|
setCursorStyle('grabbing');
|
|
@@ -1934,6 +2036,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1934
2036
|
startAnimationPosition = _getPositions2.startAnimationPosition,
|
|
1935
2037
|
endAnimationPosition = _getPositions2.endAnimationPosition,
|
|
1936
2038
|
selectedTimePosition = _getPositions2.selectedTimePosition;
|
|
2039
|
+
|
|
1937
2040
|
// Adjust mouse cursor while hovering draggable areas
|
|
1938
2041
|
var leftAnimationIconArea = isLeftAnimationIconArea(x, startAnimationPosition, DRAG_AREA_WIDTH);
|
|
1939
2042
|
var rightAnimationIconArea = isRightAnimationIconArea(x, endAnimationPosition, DRAG_AREA_WIDTH);
|
|
@@ -1979,12 +2082,12 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1979
2082
|
}
|
|
1980
2083
|
return undefined;
|
|
1981
2084
|
}, [isTimeScrollingEnabled, mapWindowRef, onWheel]);
|
|
1982
|
-
return jsxs(Box, {
|
|
2085
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
1983
2086
|
sx: {
|
|
1984
2087
|
position: 'relative',
|
|
1985
2088
|
height: TIME_SLIDER_LEGEND_HEIGHT + "px"
|
|
1986
2089
|
},
|
|
1987
|
-
children: [jsx(CustomTooltip, {
|
|
2090
|
+
children: [/*#__PURE__*/jsx(CustomTooltip, {
|
|
1988
2091
|
open: Boolean(showTooltip),
|
|
1989
2092
|
slotProps: {
|
|
1990
2093
|
popper: {
|
|
@@ -1995,7 +2098,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
1995
2098
|
}
|
|
1996
2099
|
},
|
|
1997
2100
|
title: getTooltipText(),
|
|
1998
|
-
children: jsx(Box, {
|
|
2101
|
+
children: /*#__PURE__*/jsx(Box, {
|
|
1999
2102
|
className: getTimeSliderLegendId(mapId),
|
|
2000
2103
|
"data-testid": "timeSliderLegend",
|
|
2001
2104
|
onMouseLeave: function onMouseLeave() {
|
|
@@ -2007,7 +2110,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2007
2110
|
overflow: 'hidden',
|
|
2008
2111
|
cursor: cursorStyle
|
|
2009
2112
|
},
|
|
2010
|
-
children: jsx(CanvasComponent, {
|
|
2113
|
+
children: /*#__PURE__*/jsx(CanvasComponent, {
|
|
2011
2114
|
onMouseDown: onMouseDown,
|
|
2012
2115
|
onMouseMove: onMouseMove,
|
|
2013
2116
|
onMouseUp: onMouseUp,
|
|
@@ -2019,7 +2122,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2019
2122
|
ref: node
|
|
2020
2123
|
})
|
|
2021
2124
|
})
|
|
2022
|
-
}), !!isTimeSliderHoverOn && jsx(Box, {
|
|
2125
|
+
}), !!isTimeSliderHoverOn && /*#__PURE__*/jsx(Box, {
|
|
2023
2126
|
"data-testid": "customCanvasMouseOverContainer",
|
|
2024
2127
|
onMouseLeave: function onMouseLeave() {
|
|
2025
2128
|
return setIsMouseOverCanvas(false);
|
|
@@ -2040,6 +2143,24 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
2040
2143
|
});
|
|
2041
2144
|
};
|
|
2042
2145
|
|
|
2146
|
+
/* *
|
|
2147
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2148
|
+
* you may not use this file except in compliance with the License.
|
|
2149
|
+
* You may obtain a copy of the License at
|
|
2150
|
+
*
|
|
2151
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2152
|
+
*
|
|
2153
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2154
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2155
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2156
|
+
* See the License for the specific language governing permissions and
|
|
2157
|
+
* limitations under the License.
|
|
2158
|
+
*
|
|
2159
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2160
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2161
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2162
|
+
* */
|
|
2163
|
+
|
|
2043
2164
|
var THROTTLE_WAIT_TIME = 300; // [ms]
|
|
2044
2165
|
var THROTTLE_OPTIONS = {
|
|
2045
2166
|
trailing: false // Invoke function when called, but not more than once every <THROTTLE_WAIT_TIME>.
|
|
@@ -2094,6 +2215,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2094
2215
|
}
|
|
2095
2216
|
return '';
|
|
2096
2217
|
};
|
|
2218
|
+
|
|
2097
2219
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2098
2220
|
var throttledScroll = React.useCallback(throttle(function (newValue) {
|
|
2099
2221
|
onChangeSliderValue(newValue);
|
|
@@ -2103,11 +2225,11 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2103
2225
|
var newValue = marks[Math.min(Math.max(currentMarkIndex - direction, 0), marks.length - 1)];
|
|
2104
2226
|
throttledScroll(newValue.value);
|
|
2105
2227
|
}, [currentMarkIndex, marks, throttledScroll]);
|
|
2106
|
-
return jsxs(Box, {
|
|
2228
|
+
return /*#__PURE__*/jsxs(Box, {
|
|
2107
2229
|
onKeyDown: function onKeyDown(event) {
|
|
2108
2230
|
event.stopPropagation();
|
|
2109
2231
|
},
|
|
2110
|
-
children: [jsxs(CustomIconButton, {
|
|
2232
|
+
children: [/*#__PURE__*/jsxs(CustomIconButton, {
|
|
2111
2233
|
isSelected: true,
|
|
2112
2234
|
onClick: function onClick() {
|
|
2113
2235
|
setOpen(true);
|
|
@@ -2123,7 +2245,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2123
2245
|
},
|
|
2124
2246
|
tooltipTitle: title,
|
|
2125
2247
|
variant: "tool",
|
|
2126
|
-
children: [icon, jsx(Typography, {
|
|
2248
|
+
children: [icon, /*#__PURE__*/jsx(Typography, {
|
|
2127
2249
|
sx: {
|
|
2128
2250
|
fontSize: 12,
|
|
2129
2251
|
fontWeight: 400,
|
|
@@ -2131,7 +2253,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2131
2253
|
},
|
|
2132
2254
|
children: buttonText(value, displayCurrentLength, currentMark)
|
|
2133
2255
|
})]
|
|
2134
|
-
}), !!anchorRef && jsxs(Menu, {
|
|
2256
|
+
}), !!anchorRef && /*#__PURE__*/jsxs(Menu, {
|
|
2135
2257
|
anchorEl: anchorRef,
|
|
2136
2258
|
anchorOrigin: {
|
|
2137
2259
|
vertical: -15,
|
|
@@ -2152,7 +2274,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2152
2274
|
vertical: 'bottom',
|
|
2153
2275
|
horizontal: 'center'
|
|
2154
2276
|
},
|
|
2155
|
-
children: [jsx(MenuItem, {
|
|
2277
|
+
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
2156
2278
|
disabled: true,
|
|
2157
2279
|
sx: {
|
|
2158
2280
|
fontSize: '12px',
|
|
@@ -2166,7 +2288,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2166
2288
|
children: title
|
|
2167
2289
|
}), marks.map(function (mark) {
|
|
2168
2290
|
var isSelected = (currentMark == null ? void 0 : currentMark.value) === mark.value && !isAutoSelected;
|
|
2169
|
-
return jsx(MenuItem, {
|
|
2291
|
+
return /*#__PURE__*/jsx(MenuItem, {
|
|
2170
2292
|
disabled: allOptionsDisabled,
|
|
2171
2293
|
onClick: function onClick() {
|
|
2172
2294
|
if (!isSelected) {
|
|
@@ -2177,7 +2299,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2177
2299
|
selected: !!isSelected && !displayLengthInputField,
|
|
2178
2300
|
children: mark.label || mark.text
|
|
2179
2301
|
}, mark.value);
|
|
2180
|
-
}), !!handleAutoClick && jsx(MenuItem, {
|
|
2302
|
+
}), !!handleAutoClick && /*#__PURE__*/jsx(MenuItem, {
|
|
2181
2303
|
disabled: allOptionsDisabled || isAutoDisabled,
|
|
2182
2304
|
onClick: function onClick() {
|
|
2183
2305
|
handleAutoClick();
|
|
@@ -2185,7 +2307,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2185
2307
|
},
|
|
2186
2308
|
selected: isAutoSelected,
|
|
2187
2309
|
children: t('timeslider-auto')
|
|
2188
|
-
}), !!displayCurrentLength && jsxs(MenuItem, {
|
|
2310
|
+
}), !!displayCurrentLength && /*#__PURE__*/jsxs(MenuItem, {
|
|
2189
2311
|
disabled: disbleUserSetDuration,
|
|
2190
2312
|
onClick: function onClick() {
|
|
2191
2313
|
return setDisplayLengthInputField(true);
|
|
@@ -2193,13 +2315,13 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2193
2315
|
sx: {
|
|
2194
2316
|
maxWidth: '175px'
|
|
2195
2317
|
},
|
|
2196
|
-
children: [!!displayLengthInputField && customLengthSelector, !displayLengthInputField && jsxs(Box, {
|
|
2318
|
+
children: [!!displayLengthInputField && customLengthSelector, !displayLengthInputField && /*#__PURE__*/jsxs(Box, {
|
|
2197
2319
|
sx: {
|
|
2198
2320
|
flexDirection: 'column',
|
|
2199
2321
|
display: 'flex',
|
|
2200
2322
|
flexGrow: 1
|
|
2201
2323
|
},
|
|
2202
|
-
children: [jsx(CardHeader, {
|
|
2324
|
+
children: [/*#__PURE__*/jsx(CardHeader, {
|
|
2203
2325
|
slotProps: {
|
|
2204
2326
|
title: {
|
|
2205
2327
|
fontSize: 12
|
|
@@ -2211,7 +2333,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2211
2333
|
color: 'geowebColors.greys.accessible'
|
|
2212
2334
|
},
|
|
2213
2335
|
title: t(customFieldHeader)
|
|
2214
|
-
}), jsxs(Box, {
|
|
2336
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
2215
2337
|
sx: {
|
|
2216
2338
|
flexDirection: 'row',
|
|
2217
2339
|
display: 'flex',
|
|
@@ -2219,20 +2341,20 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2219
2341
|
flexGrow: 1,
|
|
2220
2342
|
paddingTop: 0.5
|
|
2221
2343
|
},
|
|
2222
|
-
children: [jsx(Typography, {
|
|
2344
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
2223
2345
|
sx: {
|
|
2224
2346
|
fontSize: 14,
|
|
2225
2347
|
textTransform: 'none',
|
|
2226
2348
|
lineHeight: 2
|
|
2227
2349
|
},
|
|
2228
2350
|
children: minutesToDescribedDuration(value)
|
|
2229
|
-
}), jsx(CustomTooltip, {
|
|
2351
|
+
}), /*#__PURE__*/jsx(CustomTooltip, {
|
|
2230
2352
|
title: t('timeslider-edit'),
|
|
2231
|
-
children: jsx("span", {
|
|
2232
|
-
children: jsx(CustomIconButton, {
|
|
2353
|
+
children: /*#__PURE__*/jsx("span", {
|
|
2354
|
+
children: /*#__PURE__*/jsx(CustomIconButton, {
|
|
2233
2355
|
"aria-label": "edit animation option",
|
|
2234
2356
|
"data-testid": "editAnimationOption",
|
|
2235
|
-
children: jsx(Edit, {})
|
|
2357
|
+
children: /*#__PURE__*/jsx(Edit, {})
|
|
2236
2358
|
})
|
|
2237
2359
|
})
|
|
2238
2360
|
})]
|
|
@@ -2243,6 +2365,24 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
2243
2365
|
});
|
|
2244
2366
|
};
|
|
2245
2367
|
|
|
2368
|
+
/* *
|
|
2369
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2370
|
+
* you may not use this file except in compliance with the License.
|
|
2371
|
+
* You may obtain a copy of the License at
|
|
2372
|
+
*
|
|
2373
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2374
|
+
*
|
|
2375
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2376
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2377
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2378
|
+
* See the License for the specific language governing permissions and
|
|
2379
|
+
* limitations under the License.
|
|
2380
|
+
*
|
|
2381
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2382
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2383
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2384
|
+
* */
|
|
2385
|
+
|
|
2246
2386
|
var marks$2 = [{
|
|
2247
2387
|
value: AnimationLength.Minutes15,
|
|
2248
2388
|
text: 'timeslider-min',
|
|
@@ -2302,11 +2442,11 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
|
|
|
2302
2442
|
var _useState = useState(false),
|
|
2303
2443
|
open = _useState[0],
|
|
2304
2444
|
setOpen = _useState[1];
|
|
2305
|
-
return jsx(TimeSliderMenu, {
|
|
2445
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2306
2446
|
allOptionsDisabled: disabled,
|
|
2307
2447
|
displayCurrentLength: true,
|
|
2308
2448
|
handleAutoClick: toggleAnimationLengthAuto,
|
|
2309
|
-
icon: jsx(Animation, {
|
|
2449
|
+
icon: /*#__PURE__*/jsx(Animation, {
|
|
2310
2450
|
"data-testid": "animationLengthButton"
|
|
2311
2451
|
}),
|
|
2312
2452
|
isAutoDisabled: !layerHasTimeStep,
|
|
@@ -2320,6 +2460,24 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
|
|
|
2320
2460
|
});
|
|
2321
2461
|
};
|
|
2322
2462
|
|
|
2463
|
+
/* *
|
|
2464
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2465
|
+
* you may not use this file except in compliance with the License.
|
|
2466
|
+
* You may obtain a copy of the License at
|
|
2467
|
+
*
|
|
2468
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2469
|
+
*
|
|
2470
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2471
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2472
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2473
|
+
* See the License for the specific language governing permissions and
|
|
2474
|
+
* limitations under the License.
|
|
2475
|
+
*
|
|
2476
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2477
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2478
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2479
|
+
* */
|
|
2480
|
+
|
|
2323
2481
|
var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
2324
2482
|
var _ref$toggleAutoUpdate = _ref.toggleAutoUpdate,
|
|
2325
2483
|
toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {} : _ref$toggleAutoUpdate,
|
|
@@ -2329,7 +2487,7 @@ var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
|
2329
2487
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
2330
2488
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2331
2489
|
t = _useTimesliderTransla.t;
|
|
2332
|
-
return jsx(CustomIconButton, {
|
|
2490
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2333
2491
|
"data-testid": "autoUpdateButton",
|
|
2334
2492
|
disabled: disabled,
|
|
2335
2493
|
isSelected: isAutoUpdating,
|
|
@@ -2338,14 +2496,32 @@ var AutoUpdateButton = function AutoUpdateButton(_ref) {
|
|
|
2338
2496
|
},
|
|
2339
2497
|
tooltipTitle: isAutoUpdating ? t('timeslider-auto-update-on') : t('timeslider-auto-update-off'),
|
|
2340
2498
|
variant: "tool",
|
|
2341
|
-
children: isAutoUpdating ? jsx(AutoUpdateActive, {
|
|
2499
|
+
children: isAutoUpdating ? /*#__PURE__*/jsx(AutoUpdateActive, {
|
|
2342
2500
|
"data-testid": "auto-update-svg-on"
|
|
2343
|
-
}) : jsx(AutoUpdateInActive, {
|
|
2501
|
+
}) : /*#__PURE__*/jsx(AutoUpdateInActive, {
|
|
2344
2502
|
"data-testid": "auto-update-svg-off"
|
|
2345
2503
|
})
|
|
2346
2504
|
});
|
|
2347
2505
|
};
|
|
2348
2506
|
|
|
2507
|
+
/* *
|
|
2508
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2509
|
+
* you may not use this file except in compliance with the License.
|
|
2510
|
+
* You may obtain a copy of the License at
|
|
2511
|
+
*
|
|
2512
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2513
|
+
*
|
|
2514
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2515
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2516
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2517
|
+
* See the License for the specific language governing permissions and
|
|
2518
|
+
* limitations under the License.
|
|
2519
|
+
*
|
|
2520
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2521
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2522
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2523
|
+
* */
|
|
2524
|
+
|
|
2349
2525
|
var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
2350
2526
|
var isForwardStep = _ref.isForwardStep,
|
|
2351
2527
|
isDisabled = _ref.isDisabled,
|
|
@@ -2355,21 +2531,39 @@ var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
|
|
|
2355
2531
|
renderCounter.count(BackwardForwardStepButton.name);
|
|
2356
2532
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2357
2533
|
t = _useTimesliderTransla.t;
|
|
2358
|
-
return jsx(CustomIconButton, {
|
|
2534
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2359
2535
|
"aria-label": isForwardStep ? 'forward' : 'backward',
|
|
2360
2536
|
"data-testid": isForwardStep ? 'stepForwardButton' : 'stepBackwardButton',
|
|
2361
2537
|
disabled: isDisabled,
|
|
2362
2538
|
onClick: onClickBFButton,
|
|
2363
2539
|
tooltipTitle: isForwardStep ? t('timeslider-forward') : t('timeslider-backward'),
|
|
2364
2540
|
variant: "tool",
|
|
2365
|
-
children: isForwardStep ? jsx(StepForward, {
|
|
2541
|
+
children: isForwardStep ? /*#__PURE__*/jsx(StepForward, {
|
|
2366
2542
|
"data-testid": "step-forward-svg-path"
|
|
2367
|
-
}) : jsx(StepBackward, {
|
|
2543
|
+
}) : /*#__PURE__*/jsx(StepBackward, {
|
|
2368
2544
|
"data-testid": "step-backward-svg-path"
|
|
2369
2545
|
})
|
|
2370
2546
|
});
|
|
2371
2547
|
};
|
|
2372
2548
|
|
|
2549
|
+
/* *
|
|
2550
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2551
|
+
* you may not use this file except in compliance with the License.
|
|
2552
|
+
* You may obtain a copy of the License at
|
|
2553
|
+
*
|
|
2554
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2555
|
+
*
|
|
2556
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2557
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2558
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2559
|
+
* See the License for the specific language governing permissions and
|
|
2560
|
+
* limitations under the License.
|
|
2561
|
+
*
|
|
2562
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2563
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2564
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2565
|
+
* */
|
|
2566
|
+
|
|
2373
2567
|
var NowButton = function NowButton(_ref) {
|
|
2374
2568
|
var _ref$onSetNow = _ref.onSetNow,
|
|
2375
2569
|
onSetNow = _ref$onSetNow === void 0 ? function () {} : _ref$onSetNow,
|
|
@@ -2377,7 +2571,7 @@ var NowButton = function NowButton(_ref) {
|
|
|
2377
2571
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
2378
2572
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2379
2573
|
t = _useTimesliderTransla.t;
|
|
2380
|
-
return jsx(CustomIconButton, {
|
|
2574
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2381
2575
|
"aria-label": "now",
|
|
2382
2576
|
"data-testid": "nowButtonTooltip",
|
|
2383
2577
|
disabled: disabled,
|
|
@@ -2386,12 +2580,30 @@ var NowButton = function NowButton(_ref) {
|
|
|
2386
2580
|
},
|
|
2387
2581
|
tooltipTitle: t('timeslider-now'),
|
|
2388
2582
|
variant: "tool",
|
|
2389
|
-
children: jsx(Now, {
|
|
2583
|
+
children: /*#__PURE__*/jsx(Now, {
|
|
2390
2584
|
"data-testid": "now-svg"
|
|
2391
2585
|
})
|
|
2392
2586
|
});
|
|
2393
2587
|
};
|
|
2394
2588
|
|
|
2589
|
+
/* *
|
|
2590
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2591
|
+
* you may not use this file except in compliance with the License.
|
|
2592
|
+
* You may obtain a copy of the License at
|
|
2593
|
+
*
|
|
2594
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2595
|
+
*
|
|
2596
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2597
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2598
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2599
|
+
* See the License for the specific language governing permissions and
|
|
2600
|
+
* limitations under the License.
|
|
2601
|
+
*
|
|
2602
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2603
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2604
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2605
|
+
* */
|
|
2606
|
+
|
|
2395
2607
|
var PlayButton = function PlayButton(_ref) {
|
|
2396
2608
|
var isAnimating = _ref.isAnimating,
|
|
2397
2609
|
isDisabled = _ref.isDisabled,
|
|
@@ -2402,46 +2614,82 @@ var PlayButton = function PlayButton(_ref) {
|
|
|
2402
2614
|
};
|
|
2403
2615
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
2404
2616
|
t = _useTimesliderTransla.t;
|
|
2405
|
-
return jsx(CustomIconButton, {
|
|
2617
|
+
return /*#__PURE__*/jsx(CustomIconButton, {
|
|
2406
2618
|
"data-testid": "playButton",
|
|
2407
2619
|
disabled: isDisabled,
|
|
2408
2620
|
isSelected: isAnimating,
|
|
2409
2621
|
onClick: onTogglePlay,
|
|
2410
2622
|
tooltipTitle: isAnimating ? t('timeslider-pause') : t('timeslider-play'),
|
|
2411
2623
|
variant: "tool",
|
|
2412
|
-
children: isAnimating ? jsx(Pause, {
|
|
2624
|
+
children: isAnimating ? /*#__PURE__*/jsx(Pause, {
|
|
2413
2625
|
"data-testid": "pause-svg-path"
|
|
2414
|
-
}) : jsx(Play, {
|
|
2626
|
+
}) : /*#__PURE__*/jsx(Play, {
|
|
2415
2627
|
"data-testid": "play-svg-path"
|
|
2416
2628
|
})
|
|
2417
2629
|
});
|
|
2418
2630
|
};
|
|
2419
2631
|
|
|
2632
|
+
/* *
|
|
2633
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2634
|
+
* you may not use this file except in compliance with the License.
|
|
2635
|
+
* You may obtain a copy of the License at
|
|
2636
|
+
*
|
|
2637
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2638
|
+
*
|
|
2639
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2640
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2641
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2642
|
+
* See the License for the specific language governing permissions and
|
|
2643
|
+
* limitations under the License.
|
|
2644
|
+
*
|
|
2645
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2646
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2647
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2648
|
+
* */
|
|
2649
|
+
|
|
2420
2650
|
var ControlButtons = function ControlButtons(_ref) {
|
|
2421
2651
|
var backwardBtn = _ref.backwardBtn,
|
|
2422
2652
|
forwardBtn = _ref.forwardBtn,
|
|
2423
2653
|
playBtn = _ref.playBtn,
|
|
2424
2654
|
nowBtn = _ref.nowBtn,
|
|
2425
2655
|
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
2426
|
-
return jsxs(Fragment, {
|
|
2427
|
-
children: [jsx(Grid, {
|
|
2428
|
-
children: backwardBtn || jsx(BackwardForwardStepButton, {
|
|
2656
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
2657
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
2658
|
+
children: backwardBtn || /*#__PURE__*/jsx(BackwardForwardStepButton, {
|
|
2429
2659
|
isForwardStep: false
|
|
2430
2660
|
})
|
|
2431
|
-
}), jsx(Grid, {
|
|
2432
|
-
children: forwardBtn || jsx(BackwardForwardStepButton, {
|
|
2661
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2662
|
+
children: forwardBtn || /*#__PURE__*/jsx(BackwardForwardStepButton, {
|
|
2433
2663
|
isForwardStep: true
|
|
2434
2664
|
})
|
|
2435
|
-
}), jsx(Grid, {
|
|
2436
|
-
children: playBtn || jsx(PlayButton, {})
|
|
2437
|
-
}), jsx(Grid, {
|
|
2438
|
-
children: nowBtn || jsx(NowButton, {})
|
|
2439
|
-
}), jsx(Grid, {
|
|
2440
|
-
children: autoUpdateBtn || jsx(AutoUpdateButton, {})
|
|
2665
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2666
|
+
children: playBtn || /*#__PURE__*/jsx(PlayButton, {})
|
|
2667
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2668
|
+
children: nowBtn || /*#__PURE__*/jsx(NowButton, {})
|
|
2669
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2670
|
+
children: autoUpdateBtn || /*#__PURE__*/jsx(AutoUpdateButton, {})
|
|
2441
2671
|
})]
|
|
2442
2672
|
});
|
|
2443
2673
|
};
|
|
2444
2674
|
|
|
2675
|
+
/* *
|
|
2676
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2677
|
+
* you may not use this file except in compliance with the License.
|
|
2678
|
+
* You may obtain a copy of the License at
|
|
2679
|
+
*
|
|
2680
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2681
|
+
*
|
|
2682
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2683
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2684
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2685
|
+
* See the License for the specific language governing permissions and
|
|
2686
|
+
* limitations under the License.
|
|
2687
|
+
*
|
|
2688
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2689
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2690
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2691
|
+
* */
|
|
2692
|
+
|
|
2445
2693
|
var SpeedButton = function SpeedButton(_ref) {
|
|
2446
2694
|
var animationDelay = _ref.animationDelay,
|
|
2447
2695
|
setMapAnimationDelay = _ref.setMapAnimationDelay;
|
|
@@ -2460,8 +2708,8 @@ var SpeedButton = function SpeedButton(_ref) {
|
|
|
2460
2708
|
var _useState = useState(false),
|
|
2461
2709
|
open = _useState[0],
|
|
2462
2710
|
setOpen = _useState[1];
|
|
2463
|
-
return jsx(TimeSliderMenu, {
|
|
2464
|
-
icon: jsx(Speed, {}),
|
|
2711
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2712
|
+
icon: /*#__PURE__*/jsx(Speed, {}),
|
|
2465
2713
|
marks: marks,
|
|
2466
2714
|
onChangeSliderValue: function onChangeSliderValue(markValue) {
|
|
2467
2715
|
setMapAnimationDelay(markValue);
|
|
@@ -2473,6 +2721,24 @@ var SpeedButton = function SpeedButton(_ref) {
|
|
|
2473
2721
|
});
|
|
2474
2722
|
};
|
|
2475
2723
|
|
|
2724
|
+
/* *
|
|
2725
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2726
|
+
* you may not use this file except in compliance with the License.
|
|
2727
|
+
* You may obtain a copy of the License at
|
|
2728
|
+
*
|
|
2729
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2730
|
+
*
|
|
2731
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2732
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2733
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2734
|
+
* See the License for the specific language governing permissions and
|
|
2735
|
+
* limitations under the License.
|
|
2736
|
+
*
|
|
2737
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2738
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2739
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2740
|
+
* */
|
|
2741
|
+
|
|
2476
2742
|
var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
2477
2743
|
var timeSliderSpan = _ref.timeSliderSpan,
|
|
2478
2744
|
setOpen = _ref.setOpen,
|
|
@@ -2488,8 +2754,8 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2488
2754
|
var _React$useState3 = React.useState(true),
|
|
2489
2755
|
isANumber = _React$useState3[0],
|
|
2490
2756
|
setIsANumber = _React$useState3[1];
|
|
2491
|
-
return jsx(Box, {
|
|
2492
|
-
children: jsxs(FormControl, {
|
|
2757
|
+
return /*#__PURE__*/jsx(Box, {
|
|
2758
|
+
children: /*#__PURE__*/jsxs(FormControl, {
|
|
2493
2759
|
onKeyDown: function onKeyDown(event) {
|
|
2494
2760
|
event.stopPropagation();
|
|
2495
2761
|
},
|
|
@@ -2499,7 +2765,7 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2499
2765
|
display: 'flex'
|
|
2500
2766
|
},
|
|
2501
2767
|
variant: "standard",
|
|
2502
|
-
children: [jsx(TextField, {
|
|
2768
|
+
children: [/*#__PURE__*/jsx(TextField, {
|
|
2503
2769
|
autoFocus: true,
|
|
2504
2770
|
color: isANumber ? 'primary' : 'warning',
|
|
2505
2771
|
label: t('timeslider-span'),
|
|
@@ -2529,11 +2795,11 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2529
2795
|
},
|
|
2530
2796
|
value: Math.round(selectedTimeValue * 100) / 100,
|
|
2531
2797
|
variant: "standard"
|
|
2532
|
-
}), jsx(Box, {
|
|
2798
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
2533
2799
|
sx: {
|
|
2534
2800
|
alignContent: 'end'
|
|
2535
2801
|
},
|
|
2536
|
-
children: jsxs(Select, {
|
|
2802
|
+
children: /*#__PURE__*/jsxs(Select, {
|
|
2537
2803
|
"aria-label": "time-resolution-selector",
|
|
2538
2804
|
defaultValue: "h",
|
|
2539
2805
|
onChange: function onChange(e) {
|
|
@@ -2544,22 +2810,22 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2544
2810
|
size: "small",
|
|
2545
2811
|
tabIndex: -1,
|
|
2546
2812
|
value: selectedTimeResolution,
|
|
2547
|
-
children: [jsx(MenuItem, {
|
|
2813
|
+
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
2548
2814
|
value: TimeInMinutes.YEAR,
|
|
2549
2815
|
children: t('years')
|
|
2550
|
-
}), jsx(MenuItem, {
|
|
2816
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2551
2817
|
value: TimeInMinutes.MONTH,
|
|
2552
2818
|
children: t('months')
|
|
2553
|
-
}), jsx(MenuItem, {
|
|
2819
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2554
2820
|
value: TimeInMinutes.WEEK,
|
|
2555
2821
|
children: t('weeks')
|
|
2556
|
-
}), jsx(MenuItem, {
|
|
2822
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2557
2823
|
value: TimeInMinutes.DAY,
|
|
2558
2824
|
children: t('days')
|
|
2559
|
-
}), jsx(MenuItem, {
|
|
2825
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2560
2826
|
value: TimeInMinutes.HOUR,
|
|
2561
2827
|
children: t('hours')
|
|
2562
|
-
}), jsx(MenuItem, {
|
|
2828
|
+
}), /*#__PURE__*/jsx(MenuItem, {
|
|
2563
2829
|
value: TimeInMinutes.MINUTE,
|
|
2564
2830
|
children: t('minutes')
|
|
2565
2831
|
})]
|
|
@@ -2569,6 +2835,24 @@ var TimeSpanButtonCustomSelect = function TimeSpanButtonCustomSelect(_ref) {
|
|
|
2569
2835
|
});
|
|
2570
2836
|
};
|
|
2571
2837
|
|
|
2838
|
+
/* *
|
|
2839
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2840
|
+
* you may not use this file except in compliance with the License.
|
|
2841
|
+
* You may obtain a copy of the License at
|
|
2842
|
+
*
|
|
2843
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2844
|
+
*
|
|
2845
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2846
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2847
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2848
|
+
* See the License for the specific language governing permissions and
|
|
2849
|
+
* limitations under the License.
|
|
2850
|
+
*
|
|
2851
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2852
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2853
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2854
|
+
* */
|
|
2855
|
+
|
|
2572
2856
|
var marks$1 = [{
|
|
2573
2857
|
value: 60,
|
|
2574
2858
|
text: 'timeslider-hour',
|
|
@@ -2639,10 +2923,10 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2639
2923
|
var _useState = useState(isOpenByDefault),
|
|
2640
2924
|
open = _useState[0],
|
|
2641
2925
|
setOpen = _useState[1];
|
|
2642
|
-
return jsx(TimeSliderMenu, {
|
|
2926
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2643
2927
|
allOptionsDisabled: disabled,
|
|
2644
2928
|
customFieldHeader: t('timeslider-span'),
|
|
2645
|
-
customLengthSelector: jsx(TimeSpanButtonCustomSelect, {
|
|
2929
|
+
customLengthSelector: /*#__PURE__*/jsx(TimeSpanButtonCustomSelect, {
|
|
2646
2930
|
onChangeSliderValue: onChangeSliderValue,
|
|
2647
2931
|
setOpen: setOpen,
|
|
2648
2932
|
timeSliderSpan: timeSliderSpan
|
|
@@ -2650,7 +2934,7 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2650
2934
|
disbleUserSetDuration: false,
|
|
2651
2935
|
displayCurrentLength: true,
|
|
2652
2936
|
handleAutoClick: onToggleTimeSpan,
|
|
2653
|
-
icon: jsx(Clock, {}),
|
|
2937
|
+
icon: /*#__PURE__*/jsx(Clock, {}),
|
|
2654
2938
|
isAutoDisabled: !layerHasTimeStep,
|
|
2655
2939
|
isAutoSelected: isTimeSpanAuto,
|
|
2656
2940
|
marks: translatedMarks,
|
|
@@ -2662,6 +2946,24 @@ var TimeSpanButton = function TimeSpanButton(_ref) {
|
|
|
2662
2946
|
});
|
|
2663
2947
|
};
|
|
2664
2948
|
|
|
2949
|
+
/* *
|
|
2950
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2951
|
+
* you may not use this file except in compliance with the License.
|
|
2952
|
+
* You may obtain a copy of the License at
|
|
2953
|
+
*
|
|
2954
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2955
|
+
*
|
|
2956
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2957
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2958
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2959
|
+
* See the License for the specific language governing permissions and
|
|
2960
|
+
* limitations under the License.
|
|
2961
|
+
*
|
|
2962
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2963
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
2964
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2965
|
+
* */
|
|
2966
|
+
|
|
2665
2967
|
var marks = [{
|
|
2666
2968
|
value: 1,
|
|
2667
2969
|
text: 'timeslider-min',
|
|
@@ -2787,11 +3089,11 @@ var TimeStepButton = function TimeStepButton(_ref) {
|
|
|
2787
3089
|
var _useState = useState(isOpenByDefault),
|
|
2788
3090
|
open = _useState[0],
|
|
2789
3091
|
setOpen = _useState[1];
|
|
2790
|
-
return jsx(TimeSliderMenu, {
|
|
3092
|
+
return /*#__PURE__*/jsx(TimeSliderMenu, {
|
|
2791
3093
|
allOptionsDisabled: disabled,
|
|
2792
3094
|
displayCurrentLength: true,
|
|
2793
3095
|
handleAutoClick: handleToggleTimeStep,
|
|
2794
|
-
icon: jsx(FastForward, {
|
|
3096
|
+
icon: /*#__PURE__*/jsx(FastForward, {
|
|
2795
3097
|
"data-testid": "timeStepButton"
|
|
2796
3098
|
}),
|
|
2797
3099
|
isAutoDisabled: !layerHasTimeStep,
|
|
@@ -2805,17 +3107,35 @@ var TimeStepButton = function TimeStepButton(_ref) {
|
|
|
2805
3107
|
});
|
|
2806
3108
|
};
|
|
2807
3109
|
|
|
3110
|
+
/* *
|
|
3111
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3112
|
+
* you may not use this file except in compliance with the License.
|
|
3113
|
+
* You may obtain a copy of the License at
|
|
3114
|
+
*
|
|
3115
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3116
|
+
*
|
|
3117
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3118
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3119
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3120
|
+
* See the License for the specific language governing permissions and
|
|
3121
|
+
* limitations under the License.
|
|
3122
|
+
*
|
|
3123
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3124
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3125
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3126
|
+
* */
|
|
3127
|
+
|
|
2808
3128
|
var OptionsMenu = function OptionsMenu(_ref) {
|
|
2809
3129
|
var speedBtn = _ref.speedBtn,
|
|
2810
3130
|
timeSpanBtn = _ref.timeSpanBtn,
|
|
2811
3131
|
timeStepBtn = _ref.timeStepBtn,
|
|
2812
3132
|
animationLengthBtn = _ref.animationLengthBtn;
|
|
2813
|
-
return jsxs(Fragment, {
|
|
2814
|
-
children: [jsx(Grid, {
|
|
3133
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
3134
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
2815
3135
|
size: {
|
|
2816
3136
|
xs: 'auto'
|
|
2817
3137
|
},
|
|
2818
|
-
children: timeSpanBtn || jsx(TimeSpanButton, {
|
|
3138
|
+
children: timeSpanBtn || /*#__PURE__*/jsx(TimeSpanButton, {
|
|
2819
3139
|
disabled: false,
|
|
2820
3140
|
isTimeSpanAuto: false,
|
|
2821
3141
|
layerHasTimeStep: false,
|
|
@@ -2823,27 +3143,27 @@ var OptionsMenu = function OptionsMenu(_ref) {
|
|
|
2823
3143
|
onToggleTimeSpan: function onToggleTimeSpan() {},
|
|
2824
3144
|
timeSliderSpan: 0
|
|
2825
3145
|
})
|
|
2826
|
-
}), jsx(Grid, {
|
|
3146
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2827
3147
|
size: {
|
|
2828
3148
|
xs: 'auto'
|
|
2829
3149
|
},
|
|
2830
|
-
children: animationLengthBtn || jsx(AnimationLengthButton, {
|
|
3150
|
+
children: animationLengthBtn || /*#__PURE__*/jsx(AnimationLengthButton, {
|
|
2831
3151
|
onChangeAnimationLength: function onChangeAnimationLength() {},
|
|
2832
3152
|
toggleAnimationLengthAuto: function toggleAnimationLengthAuto() {}
|
|
2833
3153
|
})
|
|
2834
|
-
}), jsx(Grid, {
|
|
3154
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2835
3155
|
size: {
|
|
2836
3156
|
xs: 'auto'
|
|
2837
3157
|
},
|
|
2838
|
-
children: timeStepBtn || jsx(TimeStepButton, {
|
|
3158
|
+
children: timeStepBtn || /*#__PURE__*/jsx(TimeStepButton, {
|
|
2839
3159
|
isTimestepAuto: false,
|
|
2840
3160
|
onChangeTimeStep: function onChangeTimeStep() {}
|
|
2841
3161
|
})
|
|
2842
|
-
}), jsx(Grid, {
|
|
3162
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
2843
3163
|
size: {
|
|
2844
3164
|
xs: 'auto'
|
|
2845
3165
|
},
|
|
2846
|
-
children: speedBtn || jsx(SpeedButton, {
|
|
3166
|
+
children: speedBtn || /*#__PURE__*/jsx(SpeedButton, {
|
|
2847
3167
|
animationDelay: defaultAnimationDelayAtStart,
|
|
2848
3168
|
setMapAnimationDelay: function setMapAnimationDelay() {}
|
|
2849
3169
|
})
|
|
@@ -2851,6 +3171,24 @@ var OptionsMenu = function OptionsMenu(_ref) {
|
|
|
2851
3171
|
});
|
|
2852
3172
|
};
|
|
2853
3173
|
|
|
3174
|
+
/* *
|
|
3175
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3176
|
+
* you may not use this file except in compliance with the License.
|
|
3177
|
+
* You may obtain a copy of the License at
|
|
3178
|
+
*
|
|
3179
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3180
|
+
*
|
|
3181
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3182
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3183
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3184
|
+
* See the License for the specific language governing permissions and
|
|
3185
|
+
* limitations under the License.
|
|
3186
|
+
*
|
|
3187
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3188
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3189
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3190
|
+
* */
|
|
3191
|
+
|
|
2854
3192
|
var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
2855
3193
|
var speedBtn = _ref.speedBtn,
|
|
2856
3194
|
timeStepBtn = _ref.timeStepBtn,
|
|
@@ -2871,8 +3209,8 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2871
3209
|
setOpen(true);
|
|
2872
3210
|
}
|
|
2873
3211
|
}, [anchorEl, isOpenByDefault]);
|
|
2874
|
-
return jsxs("div", {
|
|
2875
|
-
children: [jsx(CustomIconButton, {
|
|
3212
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3213
|
+
children: [/*#__PURE__*/jsx(CustomIconButton, {
|
|
2876
3214
|
"aria-label": "animation options",
|
|
2877
3215
|
"data-testid": "optionsMenuButton",
|
|
2878
3216
|
isSelected: open,
|
|
@@ -2887,8 +3225,8 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2887
3225
|
placement: 'bottom'
|
|
2888
3226
|
},
|
|
2889
3227
|
variant: "tool",
|
|
2890
|
-
children: jsx(Options, {})
|
|
2891
|
-
}), jsx(Popper, {
|
|
3228
|
+
children: /*#__PURE__*/jsx(Options, {})
|
|
3229
|
+
}), /*#__PURE__*/jsx(Popper, {
|
|
2892
3230
|
anchorEl: anchorEl,
|
|
2893
3231
|
"data-testid": "optionsMenuPopOver",
|
|
2894
3232
|
open: open,
|
|
@@ -2896,19 +3234,19 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2896
3234
|
sx: {
|
|
2897
3235
|
zIndex: 10
|
|
2898
3236
|
},
|
|
2899
|
-
children: jsx(Paper, {
|
|
3237
|
+
children: /*#__PURE__*/jsx(Paper, {
|
|
2900
3238
|
elevation: 3,
|
|
2901
3239
|
sx: {
|
|
2902
3240
|
position: 'relative',
|
|
2903
3241
|
top: '-2rem'
|
|
2904
3242
|
},
|
|
2905
|
-
children: jsx(Grid, {
|
|
3243
|
+
children: /*#__PURE__*/jsx(Grid, {
|
|
2906
3244
|
container: true,
|
|
2907
3245
|
spacing: 1,
|
|
2908
3246
|
sx: {
|
|
2909
3247
|
padding: '10px'
|
|
2910
3248
|
},
|
|
2911
|
-
children: jsx(OptionsMenu, {
|
|
3249
|
+
children: /*#__PURE__*/jsx(OptionsMenu, {
|
|
2912
3250
|
animationLengthBtn: animationLengthBtn,
|
|
2913
3251
|
speedBtn: speedBtn,
|
|
2914
3252
|
timeSpanBtn: timeSpanBtn,
|
|
@@ -2920,6 +3258,24 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
|
|
|
2920
3258
|
});
|
|
2921
3259
|
};
|
|
2922
3260
|
|
|
3261
|
+
/* *
|
|
3262
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3263
|
+
* you may not use this file except in compliance with the License.
|
|
3264
|
+
* You may obtain a copy of the License at
|
|
3265
|
+
*
|
|
3266
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3267
|
+
*
|
|
3268
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3269
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3270
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3271
|
+
* See the License for the specific language governing permissions and
|
|
3272
|
+
* limitations under the License.
|
|
3273
|
+
*
|
|
3274
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3275
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
3276
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3277
|
+
* */
|
|
3278
|
+
|
|
2923
3279
|
var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
2924
3280
|
var optionsMenuBtn = _ref.optionsMenuBtn,
|
|
2925
3281
|
playBtn = _ref.playBtn,
|
|
@@ -2927,21 +3283,21 @@ var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
|
2927
3283
|
forwardBtn = _ref.forwardBtn,
|
|
2928
3284
|
nowBtn = _ref.nowBtn,
|
|
2929
3285
|
autoUpdateBtn = _ref.autoUpdateBtn;
|
|
2930
|
-
return jsx(Box, {
|
|
3286
|
+
return /*#__PURE__*/jsx(Box, {
|
|
2931
3287
|
"data-testid": "timeSliderButtons",
|
|
2932
3288
|
sx: {
|
|
2933
3289
|
height: 24
|
|
2934
3290
|
},
|
|
2935
|
-
children: jsxs(Grid, {
|
|
3291
|
+
children: /*#__PURE__*/jsxs(Grid, {
|
|
2936
3292
|
container: true,
|
|
2937
3293
|
spacing: 0.5,
|
|
2938
3294
|
sx: {
|
|
2939
3295
|
alignItems: 'center',
|
|
2940
3296
|
justifyContent: 'center'
|
|
2941
3297
|
},
|
|
2942
|
-
children: [jsx(Grid, {
|
|
2943
|
-
children: optionsMenuBtn || jsx(OptionsMenuButton, {})
|
|
2944
|
-
}), jsx(ControlButtons, {
|
|
3298
|
+
children: [/*#__PURE__*/jsx(Grid, {
|
|
3299
|
+
children: optionsMenuBtn || /*#__PURE__*/jsx(OptionsMenuButton, {})
|
|
3300
|
+
}), /*#__PURE__*/jsx(ControlButtons, {
|
|
2945
3301
|
autoUpdateBtn: autoUpdateBtn,
|
|
2946
3302
|
backwardBtn: backwardBtn,
|
|
2947
3303
|
forwardBtn: forwardBtn,
|
|
@@ -2969,6 +3325,7 @@ var TimeSliderButtons = function TimeSliderButtons(_ref) {
|
|
|
2969
3325
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2970
3326
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2971
3327
|
* */
|
|
3328
|
+
|
|
2972
3329
|
var onMouseMove = function onMouseMove(x, width, selectedTime, centerTime, secondsPerPx, mouseDownInTimeBox, isTimeBoxArea, setCursorStyle) {
|
|
2973
3330
|
if (!selectedTime || mouseDownInTimeBox) {
|
|
2974
3331
|
return;
|
|
@@ -3008,6 +3365,7 @@ var onMouseDown = function onMouseDown(x, width, selectedTime, centerTime, secon
|
|
|
3008
3365
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3009
3366
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3010
3367
|
* */
|
|
3368
|
+
|
|
3011
3369
|
var secondsInYear = 365 * 24 * 3600;
|
|
3012
3370
|
var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, height, cornerRadius, theme) {
|
|
3013
3371
|
ctx.save();
|
|
@@ -3018,11 +3376,14 @@ var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, heigh
|
|
|
3018
3376
|
ctx.fillStyle = playerTimeMarkers.fill;
|
|
3019
3377
|
ctx.lineWidth = timeBoxGeom.lineWidth;
|
|
3020
3378
|
var halfLineWidth = timeBoxGeom.lineWidth / 2;
|
|
3379
|
+
|
|
3021
3380
|
// Top left corner
|
|
3022
3381
|
ctx.moveTo(halfLineWidth, height / 2);
|
|
3023
3382
|
ctx.arcTo(halfLineWidth, halfLineWidth, width / 2, halfLineWidth, cornerRadius);
|
|
3383
|
+
|
|
3024
3384
|
// Top right corner
|
|
3025
3385
|
ctx.arcTo(width - halfLineWidth, halfLineWidth, width - halfLineWidth, height / 2, cornerRadius);
|
|
3386
|
+
|
|
3026
3387
|
// Bottom right corner
|
|
3027
3388
|
ctx.arcTo(width - halfLineWidth, height - halfLineWidth, width / 2, height - halfLineWidth, cornerRadius);
|
|
3028
3389
|
// Bottom left corner
|
|
@@ -3046,6 +3407,7 @@ var drawAutoUpdateIcon = function drawAutoUpdateIcon(ctx, x, y, theme, isAutoUpd
|
|
|
3046
3407
|
ctx.save();
|
|
3047
3408
|
ctx.translate(x, y);
|
|
3048
3409
|
ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4'; // ON
|
|
3410
|
+
|
|
3049
3411
|
ctx.font = "7px " + playerTimeText.fontFamily;
|
|
3050
3412
|
ctx.fillText(text, 5, 14);
|
|
3051
3413
|
ctx.restore();
|
|
@@ -3098,7 +3460,7 @@ var toUTCTime = function toUTCTime(dateTime) {
|
|
|
3098
3460
|
return dateUtils.unix(dateTime) - getTimezoneOffsetS(dateTime);
|
|
3099
3461
|
};
|
|
3100
3462
|
var OpenPicker = function OpenPicker() {
|
|
3101
|
-
return jsx(CalendarToday, {});
|
|
3463
|
+
return /*#__PURE__*/jsx(CalendarToday, {});
|
|
3102
3464
|
};
|
|
3103
3465
|
var enabledAndSelectedButtonStyle = {
|
|
3104
3466
|
borderWidth: '6px',
|
|
@@ -3198,14 +3560,14 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3198
3560
|
setIsUndefinedDateRange(!dataStartTime || !dataEndTime || dataStartTime > dataEndTime);
|
|
3199
3561
|
setIsDisabledRange(isDateRangeDisabled(localTimeValue));
|
|
3200
3562
|
}, [dataStartTime, dataEndTime, localTimeValue, isDateRangeDisabled]);
|
|
3201
|
-
return jsx(Paper, {
|
|
3563
|
+
return /*#__PURE__*/jsx(Paper, {
|
|
3202
3564
|
sx: {
|
|
3203
3565
|
borderRadius: '0px',
|
|
3204
3566
|
width: '240px'
|
|
3205
3567
|
},
|
|
3206
|
-
children: jsxs(Stack, {
|
|
3568
|
+
children: /*#__PURE__*/jsxs(Stack, {
|
|
3207
3569
|
"data-testid": "markerTimeSelector",
|
|
3208
|
-
children: [jsx(Paper, {
|
|
3570
|
+
children: [/*#__PURE__*/jsx(Paper, {
|
|
3209
3571
|
sx: {
|
|
3210
3572
|
height: '24px',
|
|
3211
3573
|
align: 'center',
|
|
@@ -3214,7 +3576,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3214
3576
|
alignItems: 'center',
|
|
3215
3577
|
borderRadius: '0px'
|
|
3216
3578
|
},
|
|
3217
|
-
children: jsx(Paper, {
|
|
3579
|
+
children: /*#__PURE__*/jsx(Paper, {
|
|
3218
3580
|
sx: {
|
|
3219
3581
|
variant: 'subtitle',
|
|
3220
3582
|
textAlign: 'center',
|
|
@@ -3231,9 +3593,9 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3231
3593
|
},
|
|
3232
3594
|
children: t('timeslider-marker')
|
|
3233
3595
|
})
|
|
3234
|
-
}), jsx(LocalizationProvider, {
|
|
3596
|
+
}), /*#__PURE__*/jsx(LocalizationProvider, {
|
|
3235
3597
|
dateAdapter: AdapterDateFns,
|
|
3236
|
-
children: jsx(DateTimePicker, {
|
|
3598
|
+
children: /*#__PURE__*/jsx(DateTimePicker, {
|
|
3237
3599
|
ampm: false,
|
|
3238
3600
|
autoFocus: true,
|
|
3239
3601
|
closeOnSelect: false,
|
|
@@ -3251,7 +3613,7 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3251
3613
|
variant: 'filled',
|
|
3252
3614
|
InputProps: {
|
|
3253
3615
|
onKeyDownCapture: handleKeyDown,
|
|
3254
|
-
endAdornment: jsx(InputAdornment, {
|
|
3616
|
+
endAdornment: /*#__PURE__*/jsx(InputAdornment, {
|
|
3255
3617
|
position: "end",
|
|
3256
3618
|
sx: {
|
|
3257
3619
|
paddingTop: '16px'
|
|
@@ -3291,6 +3653,24 @@ var MarkerTimeSelector = function MarkerTimeSelector(_ref) {
|
|
|
3291
3653
|
});
|
|
3292
3654
|
};
|
|
3293
3655
|
|
|
3656
|
+
/* *
|
|
3657
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3658
|
+
* you may not use this file except in compliance with the License.
|
|
3659
|
+
* You may obtain a copy of the License at
|
|
3660
|
+
*
|
|
3661
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3662
|
+
*
|
|
3663
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3664
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3665
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3666
|
+
* See the License for the specific language governing permissions and
|
|
3667
|
+
* limitations under the License.
|
|
3668
|
+
*
|
|
3669
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3670
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
3671
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3672
|
+
* */
|
|
3673
|
+
|
|
3294
3674
|
var style = {
|
|
3295
3675
|
'&.MuiToggleButton-root': {
|
|
3296
3676
|
color: '#B4B4B4',
|
|
@@ -3323,25 +3703,25 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3323
3703
|
setOpen = _React$useState2[1];
|
|
3324
3704
|
var _useTimesliderTransla = useTimesliderTranslation(),
|
|
3325
3705
|
t = _useTimesliderTransla.t;
|
|
3326
|
-
return jsx(ClickAwayListener, {
|
|
3706
|
+
return /*#__PURE__*/jsx(ClickAwayListener, {
|
|
3327
3707
|
mouseEvent: "onMouseDown",
|
|
3328
3708
|
onClickAway: function onClickAway() {
|
|
3329
3709
|
return setOpen(false);
|
|
3330
3710
|
},
|
|
3331
|
-
children: jsxs("div", {
|
|
3711
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
3332
3712
|
style: {
|
|
3333
3713
|
position: 'absolute',
|
|
3334
3714
|
top: '-2px',
|
|
3335
3715
|
left: calendarIconPx + "px"
|
|
3336
3716
|
},
|
|
3337
|
-
children: [jsx(CustomTooltip, {
|
|
3717
|
+
children: [/*#__PURE__*/jsx(CustomTooltip, {
|
|
3338
3718
|
slotProps: {
|
|
3339
3719
|
transition: {
|
|
3340
3720
|
exit: false
|
|
3341
3721
|
}
|
|
3342
3722
|
},
|
|
3343
3723
|
title: !open && t('timeslider-marker-placement'),
|
|
3344
|
-
children: jsx(CustomToggleButton, {
|
|
3724
|
+
children: /*#__PURE__*/jsx(CustomToggleButton, {
|
|
3345
3725
|
onClick: function onClick() {
|
|
3346
3726
|
return setOpen(!open);
|
|
3347
3727
|
},
|
|
@@ -3351,13 +3731,13 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3351
3731
|
selected: open,
|
|
3352
3732
|
sx: style,
|
|
3353
3733
|
variant: "flat",
|
|
3354
|
-
children: jsx(CalendarToday, {
|
|
3734
|
+
children: /*#__PURE__*/jsx(CalendarToday, {
|
|
3355
3735
|
style: {
|
|
3356
3736
|
marginRight: '0px'
|
|
3357
3737
|
}
|
|
3358
3738
|
})
|
|
3359
3739
|
})
|
|
3360
|
-
}), jsx(Popper, {
|
|
3740
|
+
}), /*#__PURE__*/jsx(Popper, {
|
|
3361
3741
|
anchorEl: anchorEl,
|
|
3362
3742
|
"data-testid": "dateTimePickerPopOver",
|
|
3363
3743
|
open: open,
|
|
@@ -3365,7 +3745,7 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3365
3745
|
sx: {
|
|
3366
3746
|
zIndex: 10
|
|
3367
3747
|
},
|
|
3368
|
-
children: jsx(MarkerTimeSelector, {
|
|
3748
|
+
children: /*#__PURE__*/jsx(MarkerTimeSelector, {
|
|
3369
3749
|
dataEndTime: dataEndTime,
|
|
3370
3750
|
dataStartTime: dataStartTime,
|
|
3371
3751
|
onCancel: function onCancel() {
|
|
@@ -3382,6 +3762,24 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3382
3762
|
});
|
|
3383
3763
|
};
|
|
3384
3764
|
|
|
3765
|
+
/* *
|
|
3766
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3767
|
+
* you may not use this file except in compliance with the License.
|
|
3768
|
+
* You may obtain a copy of the License at
|
|
3769
|
+
*
|
|
3770
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3771
|
+
*
|
|
3772
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3773
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3774
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3775
|
+
* See the License for the specific language governing permissions and
|
|
3776
|
+
* limitations under the License.
|
|
3777
|
+
*
|
|
3778
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3779
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3780
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3781
|
+
* */
|
|
3782
|
+
|
|
3385
3783
|
var getTimeBoxWidth = function getTimeBoxWidth(span) {
|
|
3386
3784
|
var smallWidth = timeBoxGeom.smallWidth,
|
|
3387
3785
|
largeWidth = timeBoxGeom.largeWidth,
|
|
@@ -3392,6 +3790,7 @@ var getTimeBoxWidth = function getTimeBoxWidth(span) {
|
|
|
3392
3790
|
};
|
|
3393
3791
|
var CALENDAR_ICON_LEFT_SPACING = 1;
|
|
3394
3792
|
var DEFAULT_PX_TO_MOVE_TIMESLIDER_CENTER = 25; // When the timeslider centertime is reaching the end of the canvas, move the timeslider center a bit
|
|
3793
|
+
|
|
3395
3794
|
var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
3396
3795
|
var centerTime = _ref.centerTime,
|
|
3397
3796
|
_ref$secondsPerPx = _ref.secondsPerPx,
|
|
@@ -3421,6 +3820,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3421
3820
|
canvasWidth = _React$useState3[0],
|
|
3422
3821
|
setCanvasWidth = _React$useState3[1];
|
|
3423
3822
|
var isAnimating = linkedMapAnimationInfo == null ? void 0 : linkedMapAnimationInfo.isAnimating;
|
|
3823
|
+
|
|
3424
3824
|
// Move TimeBox back to view if it goes out of bounds
|
|
3425
3825
|
useEffect(function () {
|
|
3426
3826
|
if (!(onSetCenterTime && canvasWidth && !mouseDownInTimeBox)) {
|
|
@@ -3472,19 +3872,20 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3472
3872
|
document.removeEventListener('mouseup', handleMouseUp);
|
|
3473
3873
|
};
|
|
3474
3874
|
}, [canvasWidth, centerTime, mouseDownInTimeBox, secondsPerPx, setUnfilteredSelectedTime, unfilteredSelectedTime]);
|
|
3875
|
+
|
|
3475
3876
|
// Display unfilteredSelectedTime (already snapped to available timestep)
|
|
3476
3877
|
var displayTime = unfilteredSelectedTime;
|
|
3477
3878
|
var timePx = timestampToPixel(displayTime, centerTime, canvasWidth, secondsPerPx);
|
|
3478
3879
|
var currentTimeBoxWidth = getTimeBoxWidth(span);
|
|
3479
3880
|
var calendarIconPx = timePx - currentTimeBoxWidth / 2 + CALENDAR_ICON_LEFT_SPACING;
|
|
3480
|
-
return jsxs(Box$1, {
|
|
3881
|
+
return /*#__PURE__*/jsxs(Box$1, {
|
|
3481
3882
|
className: "timeSliderTimeBox",
|
|
3482
3883
|
"data-testid": "timeSliderTimeBox",
|
|
3483
3884
|
sx: {
|
|
3484
3885
|
height: '24px',
|
|
3485
3886
|
cursor: cursorStyle
|
|
3486
3887
|
},
|
|
3487
|
-
children: [jsx(CanvasComponent, {
|
|
3888
|
+
children: [/*#__PURE__*/jsx(CanvasComponent, {
|
|
3488
3889
|
onMouseDown: function onMouseDown$1(x, y, width) {
|
|
3489
3890
|
if (!unfilteredSelectedTime) {
|
|
3490
3891
|
return;
|
|
@@ -3503,7 +3904,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3503
3904
|
renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, unfilteredSelectedTime, secondsPerPx, span, isAutoUpdating);
|
|
3504
3905
|
},
|
|
3505
3906
|
ref: node
|
|
3506
|
-
}), jsx(CalendarButton, {
|
|
3907
|
+
}), /*#__PURE__*/jsx(CalendarButton, {
|
|
3507
3908
|
calendarIconPx: calendarIconPx,
|
|
3508
3909
|
dataEndTime: dataEndTime,
|
|
3509
3910
|
dataStartTime: dataStartTime,
|
|
@@ -3520,10 +3921,28 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3520
3921
|
});
|
|
3521
3922
|
};
|
|
3522
3923
|
|
|
3924
|
+
/* *
|
|
3925
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3926
|
+
* you may not use this file except in compliance with the License.
|
|
3927
|
+
* You may obtain a copy of the License at
|
|
3928
|
+
*
|
|
3929
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3930
|
+
*
|
|
3931
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3932
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3933
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3934
|
+
* See the License for the specific language governing permissions and
|
|
3935
|
+
* limitations under the License.
|
|
3936
|
+
*
|
|
3937
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3938
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3939
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3940
|
+
* */
|
|
3941
|
+
|
|
3523
3942
|
var TimesliderI18nProvider = function TimesliderI18nProvider(_ref) {
|
|
3524
3943
|
var children = _ref.children;
|
|
3525
3944
|
initTimesliderI18n();
|
|
3526
|
-
return jsx(I18nextProvider, {
|
|
3945
|
+
return /*#__PURE__*/jsx(I18nextProvider, {
|
|
3527
3946
|
i18n: i18n,
|
|
3528
3947
|
children: children
|
|
3529
3948
|
});
|
|
@@ -3533,8 +3952,8 @@ var DemoWrapper = function DemoWrapper(_ref2) {
|
|
|
3533
3952
|
_ref2$theme = _ref2.theme,
|
|
3534
3953
|
theme = _ref2$theme === void 0 ? 'light' : _ref2$theme;
|
|
3535
3954
|
var themeToApply = theme === 'light' ? lightTheme : darkTheme;
|
|
3536
|
-
return jsx(TimesliderI18nProvider, {
|
|
3537
|
-
children: jsx(ThemeWrapper, {
|
|
3955
|
+
return /*#__PURE__*/jsx(TimesliderI18nProvider, {
|
|
3956
|
+
children: /*#__PURE__*/jsx(ThemeWrapper, {
|
|
3538
3957
|
theme: themeToApply,
|
|
3539
3958
|
children: children
|
|
3540
3959
|
})
|