@opengeoweb/time-slider 20.0.0 → 20.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +766 -783
- package/dist/src/lib/components/TimeSlider/timeSliderUtils.d.ts +9 -33
- package/dist/src/lib/components/TimeSliderButtons/AnimationLengthPanel/animationLengthUtils.d.ts +20 -0
- package/dist/src/lib/components/TimeSliderButtons/index.d.ts +0 -1
- package/dist/src/lib/components/TimeSliderLegend/TimeSliderLegend.d.ts +3 -0
- package/dist/src/lib/components/TimeSliderLegend/timeSliderLegendUtils.d.ts +4 -2
- package/package.json +3 -3
- package/dist/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +0 -12
|
@@ -16,16 +16,6 @@ export declare enum Scale {
|
|
|
16
16
|
Months3 = 8,
|
|
17
17
|
Year = 9
|
|
18
18
|
}
|
|
19
|
-
export declare enum AnimationLength {
|
|
20
|
-
Minutes15 = 15,
|
|
21
|
-
Minutes30 = 30,
|
|
22
|
-
Hours1 = 60,
|
|
23
|
-
Hours2 = 120,
|
|
24
|
-
Hours3 = 180,
|
|
25
|
-
Hours6 = 360,
|
|
26
|
-
Hours12 = 720,
|
|
27
|
-
Hours24 = 1440
|
|
28
|
-
}
|
|
29
19
|
export type SpeedFactorType = 0.1 | 0.2 | 0.5 | 1 | 2 | 4 | 8 | 16;
|
|
30
20
|
/**
|
|
31
21
|
* In this Map collection all fundamental scales
|
|
@@ -49,24 +39,8 @@ export declare const scalingCoefficient: (end: number, start: number, width: num
|
|
|
49
39
|
export declare const timestampToPixelEdges: (timestamp: number, start: number, end: number, width: number) => number;
|
|
50
40
|
export declare const timestampToPixel: (timestamp: number, centerTime: number, widthPx: number, secondsPerPx: number) => number;
|
|
51
41
|
export declare const pixelToTimestamp: (timePx: number, centerTime: number, widthPx: number, secondsPerPx: number) => number;
|
|
52
|
-
/**
|
|
53
|
-
* This function creates and returns an array where there is secondsPerPx
|
|
54
|
-
* number of the data set added for a data scale (secondsPerPx)
|
|
55
|
-
* to secondsPerPxToScale.
|
|
56
|
-
* @param secondsPerPx
|
|
57
|
-
* @returns an array containing secondsPerPx numbers.
|
|
58
|
-
* The secondsPerPx number for a data scale is included
|
|
59
|
-
* contrary to secondsPerPxToScale.
|
|
60
|
-
*/
|
|
61
|
-
export declare const secondsPerPxValues: (secondsPerPx: number) => number[];
|
|
62
42
|
export declare const secondsPerPxFromCanvasWidth: (canvasWidth: number, spanInSeconds: number) => number | undefined;
|
|
63
43
|
export declare const getNewCenterOfFixedPointZoom: (fixedTimePoint: number, oldSecondsPerPx: number, newSecondsPerPx: number, oldCenterTime: number) => number;
|
|
64
|
-
/**
|
|
65
|
-
* Move the time slider such that a given time point (timePoint)
|
|
66
|
-
* is at a given pixel width (timePointPx).
|
|
67
|
-
* @returns a new center time for the resulting position
|
|
68
|
-
*/
|
|
69
|
-
export declare const moveRelativeToTimePoint: (timePoint: number, timePointPx: number, secondsPerPx: number, canvasWidth: number) => number;
|
|
70
44
|
/** This reusable custom hook tells whether given pointer event targets current canvas node.
|
|
71
45
|
* Example:
|
|
72
46
|
*
|
|
@@ -107,9 +81,17 @@ export declare const minutesToDescribedDuration: (minutes: number) => string;
|
|
|
107
81
|
* @returns
|
|
108
82
|
*/
|
|
109
83
|
export declare function getLargestTimeUnit(minutes: number): number;
|
|
84
|
+
/** For a data scale an appropriate fundamental scale is chosen
|
|
85
|
+
* depending on secondsPerPx of data. When a time range of
|
|
86
|
+
* data is for example many months. the fundamental scale Scale.Year
|
|
87
|
+
* is chosen here and the legend of the time slider is drawn in the
|
|
88
|
+
* same as if originally a year scale would have been chose.
|
|
89
|
+
*
|
|
90
|
+
* If a time range of data is a few weeks, Scale.Month is chosen. So, all
|
|
91
|
+
* the time range of data can be shown in the window.
|
|
92
|
+
*/
|
|
110
93
|
export declare const getFundamentalScale: (secondsPerPx: number) => Scale;
|
|
111
94
|
export declare const getScaleFromSpan: (span: number) => Scale;
|
|
112
|
-
export declare const calculateMouseTimeAndCheckBounds: (x: number, startAnimationPosition: number, endAnimationPosition: number, DRAG_AREA_WIDTH: number, pixelsBetweenViewportAndTimesliderOnLeft: number | undefined, centerTime: number, canvasWidth: number, secondsPerPx: number, tooltipPosition: React.RefObject<number | undefined>) => number | undefined;
|
|
113
95
|
export declare const defaultAnimationDelayAtStart = 250;
|
|
114
96
|
export declare const defaultDelay = 1000;
|
|
115
97
|
export declare const defaultTimeStep = 60;
|
|
@@ -121,9 +103,3 @@ export declare const roundWithTimeStep: (unixTime: number, timeStep: number, typ
|
|
|
121
103
|
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
122
104
|
*/
|
|
123
105
|
export declare const getSpeedDelay: (speedFactor: SpeedFactorType) => number;
|
|
124
|
-
export declare const timeSliderLegendDefaultProps: {
|
|
125
|
-
timeSliderWidth: number;
|
|
126
|
-
centerTime: number;
|
|
127
|
-
secondsPerPx: number;
|
|
128
|
-
selectedTime: number;
|
|
129
|
-
};
|
package/dist/src/lib/components/TimeSliderButtons/AnimationLengthPanel/animationLengthUtils.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export interface RelativeTimeOffset {
|
|
|
11
11
|
value: number;
|
|
12
12
|
unit: TimeUnit;
|
|
13
13
|
}
|
|
14
|
+
export declare const maxOffsetByUnit: Record<TimeUnit, number>;
|
|
15
|
+
/** Shared by the menu and the slider handles, so neither can reach an offset the other rejects. */
|
|
16
|
+
export declare const clampOffset: ({ value, unit, }: RelativeTimeOffset) => RelativeTimeOffset;
|
|
14
17
|
export interface OffsetSelections {
|
|
15
18
|
startOffset: RelativeTimeOffset;
|
|
16
19
|
endOffset: RelativeTimeOffset;
|
|
@@ -81,6 +84,8 @@ export declare const isRecurringPeriodMode: (mode: AnimationLengthMode) => mode
|
|
|
81
84
|
export declare const isValidAnchorTime: (anchorTime?: string) => boolean;
|
|
82
85
|
/** The offsets of whichever mode is selected; the modes without offsets use the defaults. */
|
|
83
86
|
export declare const activeOffsets: (setting: AnimationLengthSetting) => OffsetSelections;
|
|
87
|
+
/** The unit the offsets are edited and dragged in. */
|
|
88
|
+
export declare const activeEditUnit: (setting: AnimationLengthSetting) => TimeUnit;
|
|
84
89
|
export declare const defaultRecurringPeriodSelections: (now?: Date) => RecurringPeriodSelections;
|
|
85
90
|
/** Presets carry settings the compiler cannot vouch for, so the selected mode is given the slice it needs. */
|
|
86
91
|
export declare const withModeSelections: (setting: AnimationLengthSetting, now?: Date) => AnimationLengthSetting;
|
|
@@ -89,12 +94,27 @@ export declare const withModeSelections: (setting: AnimationLengthSetting, now?:
|
|
|
89
94
|
* window it resolves rolls onto the next day once the clock passes midnight.
|
|
90
95
|
*/
|
|
91
96
|
export declare const resolveAnchorInstant: (setting: AnimationLengthSetting, now?: Date) => Date;
|
|
97
|
+
/**
|
|
98
|
+
* The instant a mode counts its offsets from. Only ReferenceTime takes one from
|
|
99
|
+
* outside, so handing a layer's reference time to any other mode cannot move it.
|
|
100
|
+
*/
|
|
101
|
+
export declare const anchorInstantFor: (setting: AnimationLengthSetting, referenceTime?: string, now?: Date) => Date;
|
|
92
102
|
/**
|
|
93
103
|
* Offsets are signed: negative lands before the anchor, positive after. They are
|
|
94
104
|
* applied as calendar durations, so "+ 1 month" lands on the same day of the next
|
|
95
105
|
* month rather than a fixed number of days later.
|
|
96
106
|
*/
|
|
97
107
|
export declare const resolveAnimationRange: (setting: AnimationLengthSetting, now?: Date) => AnimationRange;
|
|
108
|
+
/** The whole-unit offset landing nearest the instant, so a handle reaches only what the menu can express. */
|
|
109
|
+
export declare const offsetForInstant: (anchor: Date, instant: Date, unit: TimeUnit) => RelativeTimeOffset;
|
|
110
|
+
/** Snaps a dragged handle onto the grid the mode's offsets can describe. */
|
|
111
|
+
export declare const snapInstantToOffsetGrid: (anchor: Date, instant: Date, unit: TimeUnit) => Date;
|
|
112
|
+
/**
|
|
113
|
+
* A range set on the slider belongs to whichever mode is selected, so only that mode's
|
|
114
|
+
* own selections change, and only on the edges the range names; the modes that read their
|
|
115
|
+
* range from elsewhere keep it, and so does an edge the mode's offsets cannot reach.
|
|
116
|
+
*/
|
|
117
|
+
export declare const withDraggedRange: (setting: AnimationLengthSetting, range: Partial<AnimationRange>, now?: Date) => AnimationLengthSetting;
|
|
98
118
|
/** Offsets can use different units, so validity is decided on the resolved instants. */
|
|
99
119
|
/** Exact names its range outright; every other mode resolves one from its offsets. */
|
|
100
120
|
export declare const settingRange: (setting: AnimationLengthSetting, now?: Date) => AnimationRange;
|
|
@@ -26,6 +26,9 @@ export interface TimeSliderLegendProps {
|
|
|
26
26
|
setIsDraggingEndAnimation?: (isDraggingEndAnimation: boolean) => void;
|
|
27
27
|
onStartTimeChange?: (startTime: number) => void;
|
|
28
28
|
onEndTimeChange?: (endTime: number) => void;
|
|
29
|
+
/** Positions the handles may occupy; defaults to the time step grid. */
|
|
30
|
+
snapAnimationTime?: (timeUnix: number) => number;
|
|
31
|
+
isAnimationRangeDraggable?: boolean;
|
|
29
32
|
onSetTimeSliderSpan?: (newSpan: number, newCenterTime: number) => void;
|
|
30
33
|
adjustSelectedTimeOnWheel?: ({ event, deltaY, }: {
|
|
31
34
|
event: WheelEvent | KeyboardEvent;
|
|
@@ -25,8 +25,10 @@ export declare const timeValues: number[];
|
|
|
25
25
|
export declare const TIME_SLIDER_LEGEND_HEIGHT = 24;
|
|
26
26
|
export declare const DRAG_AREA_WIDTH = 24;
|
|
27
27
|
export type ShowTooltip = 'animationStart' | 'animationEnd' | 'mousePointer' | undefined;
|
|
28
|
-
export declare const isDraggingStartWithinBounds: (endPos: number, mousePosition: number) => boolean;
|
|
29
|
-
export declare const isDraggingEndWithinBounds: (startPos: number, mousePosition: number, canvasWidth: number) => boolean;
|
|
28
|
+
export declare const isDraggingStartWithinBounds: (endPos: number, mousePosition: number, startPos: number) => boolean;
|
|
29
|
+
export declare const isDraggingEndWithinBounds: (startPos: number, mousePosition: number, canvasWidth: number, endPos: number) => boolean;
|
|
30
|
+
/** The animation holds one frame per time step, so a wide enough range would outgrow the limit. */
|
|
31
|
+
export declare const exceedsAnimationStepLimit: (startTimeUnix: number, endTimeUnix: number, timeStepInMinutes?: number) => boolean;
|
|
30
32
|
export declare const getTimeSliderLegendId: (mapId: string) => string;
|
|
31
33
|
export declare const getTimeSliderLegendElement: (mapId: string) => Element | null;
|
|
32
34
|
export declare const getPixelsBetweenViewportAndTimesliderOnLeft: (mapId: string) => number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/time-slider",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.1",
|
|
4
4
|
"description": "GeoWeb time-slider library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@opengeoweb/shared": "20.0.
|
|
23
|
+
"@opengeoweb/shared": "20.0.1",
|
|
24
24
|
"lodash": "^4.18.1",
|
|
25
|
-
"@opengeoweb/theme": "20.0.
|
|
25
|
+
"@opengeoweb/theme": "20.0.1",
|
|
26
26
|
"@mui/x-date-pickers": "^9.3.0",
|
|
27
27
|
"@mui/system": "^9.0.1",
|
|
28
28
|
"i18next": "^25.0.1",
|
package/dist/src/lib/components/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AnimationLength } from '../../TimeSlider/timeSliderUtils';
|
|
3
|
-
interface AnimationLengthButtonProps {
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
animationLength?: AnimationLength;
|
|
6
|
-
isAuto?: boolean;
|
|
7
|
-
layerHasTimeStep?: boolean;
|
|
8
|
-
onChangeAnimationLength?: (length: number) => void;
|
|
9
|
-
toggleAnimationLengthAuto?: () => void;
|
|
10
|
-
}
|
|
11
|
-
export declare const AnimationLengthButton: ({ disabled, animationLength, isAuto, layerHasTimeStep, onChangeAnimationLength, toggleAnimationLengthAuto, }: AnimationLengthButtonProps) => React.ReactElement;
|
|
12
|
-
export {};
|