@opengeoweb/time-slider 13.2.1 → 14.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
CHANGED
|
@@ -1240,9 +1240,11 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1240
1240
|
onClose: function onClose() {
|
|
1241
1241
|
return setOpen(false);
|
|
1242
1242
|
},
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1243
|
+
slotProps: {
|
|
1244
|
+
backdrop: {
|
|
1245
|
+
sx: {
|
|
1246
|
+
backgroundColor: 'transparent'
|
|
1247
|
+
}
|
|
1246
1248
|
}
|
|
1247
1249
|
},
|
|
1248
1250
|
anchorOrigin: {
|
|
@@ -1307,8 +1309,10 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
|
|
|
1307
1309
|
padding: 0,
|
|
1308
1310
|
color: 'geowebColors.greys.accessible'
|
|
1309
1311
|
},
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
+
slotProps: {
|
|
1313
|
+
title: {
|
|
1314
|
+
fontSize: 12
|
|
1315
|
+
}
|
|
1312
1316
|
}
|
|
1313
1317
|
}), jsxs(Box, {
|
|
1314
1318
|
sx: {
|
|
@@ -3212,10 +3216,12 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
|
|
|
3212
3216
|
children: [jsx(CustomTooltip, {
|
|
3213
3217
|
title: getTooltipText(),
|
|
3214
3218
|
open: Boolean(showTooltip),
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
+
slotProps: {
|
|
3220
|
+
popper: {
|
|
3221
|
+
popperRef: popperRef,
|
|
3222
|
+
anchorEl: {
|
|
3223
|
+
getBoundingClientRect: setTooltipPosition
|
|
3224
|
+
}
|
|
3219
3225
|
}
|
|
3220
3226
|
},
|
|
3221
3227
|
children: jsx(Box, {
|
|
@@ -3745,8 +3751,10 @@ var CalendarButton = function CalendarButton(_ref) {
|
|
|
3745
3751
|
},
|
|
3746
3752
|
children: [jsx(CustomTooltip, {
|
|
3747
3753
|
title: !open && t('timeslider-marker-placement'),
|
|
3748
|
-
|
|
3749
|
-
|
|
3754
|
+
slotProps: {
|
|
3755
|
+
transition: {
|
|
3756
|
+
exit: false
|
|
3757
|
+
}
|
|
3750
3758
|
},
|
|
3751
3759
|
children: jsx(CustomToggleButton, {
|
|
3752
3760
|
sx: style,
|
|
@@ -3798,6 +3806,7 @@ var getTimeBoxWidth = function getTimeBoxWidth(span) {
|
|
|
3798
3806
|
return mainWidth + iconWidth + calendarWidth;
|
|
3799
3807
|
};
|
|
3800
3808
|
var CALENDAR_ICON_LEFT_SPACING = 1;
|
|
3809
|
+
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
|
|
3801
3810
|
var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
3802
3811
|
var centerTime = _ref.centerTime,
|
|
3803
3812
|
_ref$secondsPerPx = _ref.secondsPerPx,
|
|
@@ -3808,6 +3817,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3808
3817
|
dataStartTime = _ref.dataStartTime,
|
|
3809
3818
|
dataEndTime = _ref.dataEndTime,
|
|
3810
3819
|
unfilteredSelectedTime = _ref.unfilteredSelectedTime,
|
|
3820
|
+
linkedMapAnimationInfo = _ref.linkedMapAnimationInfo,
|
|
3811
3821
|
isAutoUpdating = _ref.isAutoUpdating,
|
|
3812
3822
|
setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
|
|
3813
3823
|
onCalendarSelect = _ref.onCalendarSelect,
|
|
@@ -3825,20 +3835,25 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
|
|
|
3825
3835
|
var _React$useState3 = React__default.useState(0),
|
|
3826
3836
|
canvasWidth = _React$useState3[0],
|
|
3827
3837
|
setCanvasWidth = _React$useState3[1];
|
|
3838
|
+
var isAnimating = linkedMapAnimationInfo == null ? void 0 : linkedMapAnimationInfo.isAnimating;
|
|
3828
3839
|
// Move TimeBox back to view if it goes out of bounds
|
|
3829
3840
|
useEffect(function () {
|
|
3830
3841
|
if (!(onSetCenterTime && canvasWidth && !mouseDownInTimeBox)) {
|
|
3831
3842
|
return;
|
|
3832
3843
|
}
|
|
3833
3844
|
var receivedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx);
|
|
3834
|
-
var moveWidth = getAutoMoveAreaWidth(getFundamentalScale(secondsPerPx));
|
|
3845
|
+
var moveWidth = isAnimating ? DEFAULT_PX_TO_MOVE_TIMESLIDER_CENTER : getAutoMoveAreaWidth(getFundamentalScale(secondsPerPx));
|
|
3846
|
+
if (moveWidth > canvasWidth / 2 || canvasWidth < 100) {
|
|
3847
|
+
// don't move if the moveWidth is larger than half the canvaswidth or canvaswidth is very small
|
|
3848
|
+
return;
|
|
3849
|
+
}
|
|
3835
3850
|
if (receivedTimePx < moveWidth) {
|
|
3836
3851
|
onSetCenterTime(pixelToTimestamp(canvasWidth / 2 - (moveWidth - receivedTimePx), centerTime, canvasWidth, secondsPerPx));
|
|
3837
3852
|
} else if (receivedTimePx > canvasWidth - moveWidth) {
|
|
3838
3853
|
onSetCenterTime(pixelToTimestamp(canvasWidth / 2 + (receivedTimePx - (canvasWidth - moveWidth)), centerTime, canvasWidth, secondsPerPx));
|
|
3839
3854
|
}
|
|
3840
3855
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3841
|
-
}, [unfilteredSelectedTime]);
|
|
3856
|
+
}, [unfilteredSelectedTime, isAnimating]);
|
|
3842
3857
|
var isTimeBoxArea = function isTimeBoxArea(x, selectedTimePx) {
|
|
3843
3858
|
return x > selectedTimePx - timeBoxWidth / 2 && x < selectedTimePx + timeBoxWidth / 2;
|
|
3844
3859
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/time-slider",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "GeoWeb time-slider library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/shared": "
|
|
11
|
+
"@opengeoweb/shared": "14.0.0",
|
|
12
12
|
"lodash": "^4.17.21",
|
|
13
|
-
"@opengeoweb/theme": "
|
|
13
|
+
"@opengeoweb/theme": "14.0.0",
|
|
14
14
|
"@mui/x-date-pickers": "^8.11.2",
|
|
15
15
|
"react-draggable": "^4.4.6",
|
|
16
16
|
"re-resizable": "^6.9.11",
|
|
@@ -7,6 +7,10 @@ export interface TimeSliderCurrentTimeBoxProps {
|
|
|
7
7
|
dataEndTime?: number;
|
|
8
8
|
timeStep?: number;
|
|
9
9
|
unfilteredSelectedTime: number;
|
|
10
|
+
linkedMapAnimationInfo?: {
|
|
11
|
+
id: string;
|
|
12
|
+
isAnimating: boolean;
|
|
13
|
+
};
|
|
10
14
|
isAutoUpdating?: boolean;
|
|
11
15
|
setUnfilteredSelectedTime: (unfilteredSelectedTime: number) => void;
|
|
12
16
|
onCalendarSelect: (newTime: number) => void;
|