@camstack/ui-library 1.1.14 → 1.1.15
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.
|
@@ -13,9 +13,10 @@ interface TimelineControlsProps {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Date selector + zoom-in / zoom-out buttons for the recording timeline.
|
|
16
|
-
* Zoom cycles through ZOOM_LEVELS (widest → narrowest),
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Zoom cycles through ZOOM_LEVELS (widest → narrowest), anchored on the view's
|
|
17
|
+
* RIGHT edge — so on today's timeline "now" stays pinned to the right instead
|
|
18
|
+
* of drifting to a midday range. Horizontal pan (wheel) then moves the window
|
|
19
|
+
* back/forward in time. Pan is wired via wheel events in RecordingTimeline.
|
|
19
20
|
*/
|
|
20
21
|
export declare function TimelineControls({ day, onDayChange, view, dayBounds, onViewChange, }: TimelineControlsProps): import("react").JSX.Element;
|
|
21
22
|
export {};
|
|
@@ -58,10 +58,17 @@ export declare function dayWindow(date: Date, nowMs: number): DayWindow;
|
|
|
58
58
|
/** Available zoom levels in ms, from widest (24h) to narrowest (15 min). */
|
|
59
59
|
export declare const ZOOM_LEVELS: readonly number[];
|
|
60
60
|
/**
|
|
61
|
-
* Produce a `levelMs`-wide
|
|
62
|
-
* `
|
|
61
|
+
* Produce a `levelMs`-wide window whose RIGHT edge stays anchored at
|
|
62
|
+
* `rightEdgeMs` (clamped within `dayBounds`), rather than centring on the view
|
|
63
|
+
* midpoint. On today's timeline the view's right edge is "now", so zooming this
|
|
64
|
+
* way keeps the most recent footage pinned to the right instead of drifting to
|
|
65
|
+
* a midday range that no longer contains now. Panning then moves back/forward.
|
|
66
|
+
*
|
|
67
|
+
* Falls back to `dayBounds` when `levelMs` meets or exceeds the day span (can't
|
|
68
|
+
* show a wider window than the day holds — e.g. early morning with little
|
|
69
|
+
* elapsed time).
|
|
63
70
|
*/
|
|
64
|
-
export declare function
|
|
71
|
+
export declare function zoomWindowAnchoredRight(dayBounds: DayWindow, levelMs: number, rightEdgeMs: number): DayWindow;
|
|
65
72
|
/**
|
|
66
73
|
* Shift `win` by `deltaMs`, preserving width, clamped within `dayBounds`.
|
|
67
74
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -32695,23 +32695,21 @@ var ZOOM_LEVELS = [
|
|
|
32695
32695
|
15 * 6e4
|
|
32696
32696
|
];
|
|
32697
32697
|
/**
|
|
32698
|
-
* Produce a `levelMs`-wide
|
|
32699
|
-
* `
|
|
32698
|
+
* Produce a `levelMs`-wide window whose RIGHT edge stays anchored at
|
|
32699
|
+
* `rightEdgeMs` (clamped within `dayBounds`), rather than centring on the view
|
|
32700
|
+
* midpoint. On today's timeline the view's right edge is "now", so zooming this
|
|
32701
|
+
* way keeps the most recent footage pinned to the right instead of drifting to
|
|
32702
|
+
* a midday range that no longer contains now. Panning then moves back/forward.
|
|
32703
|
+
*
|
|
32704
|
+
* Falls back to `dayBounds` when `levelMs` meets or exceeds the day span (can't
|
|
32705
|
+
* show a wider window than the day holds — e.g. early morning with little
|
|
32706
|
+
* elapsed time).
|
|
32700
32707
|
*/
|
|
32701
|
-
function
|
|
32708
|
+
function zoomWindowAnchoredRight(dayBounds, levelMs, rightEdgeMs) {
|
|
32702
32709
|
if (levelMs >= dayBounds.toMs - dayBounds.fromMs) return dayBounds;
|
|
32703
|
-
|
|
32704
|
-
let toMs = centerMs + levelMs / 2;
|
|
32705
|
-
if (fromMs < dayBounds.fromMs) {
|
|
32706
|
-
fromMs = dayBounds.fromMs;
|
|
32707
|
-
toMs = fromMs + levelMs;
|
|
32708
|
-
}
|
|
32709
|
-
if (toMs > dayBounds.toMs) {
|
|
32710
|
-
toMs = dayBounds.toMs;
|
|
32711
|
-
fromMs = toMs - levelMs;
|
|
32712
|
-
}
|
|
32710
|
+
const toMs = Math.min(Math.max(rightEdgeMs, dayBounds.fromMs + levelMs), dayBounds.toMs);
|
|
32713
32711
|
return {
|
|
32714
|
-
fromMs,
|
|
32712
|
+
fromMs: toMs - levelMs,
|
|
32715
32713
|
toMs
|
|
32716
32714
|
};
|
|
32717
32715
|
}
|
|
@@ -33026,9 +33024,10 @@ function parseDateInput(value) {
|
|
|
33026
33024
|
}
|
|
33027
33025
|
/**
|
|
33028
33026
|
* Date selector + zoom-in / zoom-out buttons for the recording timeline.
|
|
33029
|
-
* Zoom cycles through ZOOM_LEVELS (widest → narrowest),
|
|
33030
|
-
*
|
|
33031
|
-
*
|
|
33027
|
+
* Zoom cycles through ZOOM_LEVELS (widest → narrowest), anchored on the view's
|
|
33028
|
+
* RIGHT edge — so on today's timeline "now" stays pinned to the right instead
|
|
33029
|
+
* of drifting to a midday range. Horizontal pan (wheel) then moves the window
|
|
33030
|
+
* back/forward in time. Pan is wired via wheel events in RecordingTimeline.
|
|
33032
33031
|
*/
|
|
33033
33032
|
function TimelineControls({ day, onDayChange, view, dayBounds, onViewChange }) {
|
|
33034
33033
|
const handleDateChange = (e) => {
|
|
@@ -33050,16 +33049,16 @@ function TimelineControls({ day, onDayChange, view, dayBounds, onViewChange }) {
|
|
|
33050
33049
|
}
|
|
33051
33050
|
return best;
|
|
33052
33051
|
})();
|
|
33053
|
-
const
|
|
33052
|
+
const rightEdgeMs = view.toMs;
|
|
33054
33053
|
const handleZoomIn = () => {
|
|
33055
33054
|
const nextLevel = ZOOM_LEVELS[Math.min(currentLevelIdx + 1, ZOOM_LEVELS.length - 1)];
|
|
33056
33055
|
if (nextLevel === void 0) return;
|
|
33057
|
-
onViewChange(
|
|
33056
|
+
onViewChange(zoomWindowAnchoredRight(dayBounds, nextLevel, rightEdgeMs));
|
|
33058
33057
|
};
|
|
33059
33058
|
const handleZoomOut = () => {
|
|
33060
33059
|
const nextLevel = ZOOM_LEVELS[Math.max(currentLevelIdx - 1, 0)];
|
|
33061
33060
|
if (nextLevel === void 0) return;
|
|
33062
|
-
onViewChange(
|
|
33061
|
+
onViewChange(zoomWindowAnchoredRight(dayBounds, nextLevel, rightEdgeMs));
|
|
33063
33062
|
};
|
|
33064
33063
|
const canZoomIn = currentLevelIdx < ZOOM_LEVELS.length - 1;
|
|
33065
33064
|
const canZoomOut = currentLevelIdx > 0;
|
package/dist/index.js
CHANGED
|
@@ -32671,23 +32671,21 @@ var ZOOM_LEVELS = [
|
|
|
32671
32671
|
15 * 6e4
|
|
32672
32672
|
];
|
|
32673
32673
|
/**
|
|
32674
|
-
* Produce a `levelMs`-wide
|
|
32675
|
-
* `
|
|
32674
|
+
* Produce a `levelMs`-wide window whose RIGHT edge stays anchored at
|
|
32675
|
+
* `rightEdgeMs` (clamped within `dayBounds`), rather than centring on the view
|
|
32676
|
+
* midpoint. On today's timeline the view's right edge is "now", so zooming this
|
|
32677
|
+
* way keeps the most recent footage pinned to the right instead of drifting to
|
|
32678
|
+
* a midday range that no longer contains now. Panning then moves back/forward.
|
|
32679
|
+
*
|
|
32680
|
+
* Falls back to `dayBounds` when `levelMs` meets or exceeds the day span (can't
|
|
32681
|
+
* show a wider window than the day holds — e.g. early morning with little
|
|
32682
|
+
* elapsed time).
|
|
32676
32683
|
*/
|
|
32677
|
-
function
|
|
32684
|
+
function zoomWindowAnchoredRight(dayBounds, levelMs, rightEdgeMs) {
|
|
32678
32685
|
if (levelMs >= dayBounds.toMs - dayBounds.fromMs) return dayBounds;
|
|
32679
|
-
|
|
32680
|
-
let toMs = centerMs + levelMs / 2;
|
|
32681
|
-
if (fromMs < dayBounds.fromMs) {
|
|
32682
|
-
fromMs = dayBounds.fromMs;
|
|
32683
|
-
toMs = fromMs + levelMs;
|
|
32684
|
-
}
|
|
32685
|
-
if (toMs > dayBounds.toMs) {
|
|
32686
|
-
toMs = dayBounds.toMs;
|
|
32687
|
-
fromMs = toMs - levelMs;
|
|
32688
|
-
}
|
|
32686
|
+
const toMs = Math.min(Math.max(rightEdgeMs, dayBounds.fromMs + levelMs), dayBounds.toMs);
|
|
32689
32687
|
return {
|
|
32690
|
-
fromMs,
|
|
32688
|
+
fromMs: toMs - levelMs,
|
|
32691
32689
|
toMs
|
|
32692
32690
|
};
|
|
32693
32691
|
}
|
|
@@ -33002,9 +33000,10 @@ function parseDateInput(value) {
|
|
|
33002
33000
|
}
|
|
33003
33001
|
/**
|
|
33004
33002
|
* Date selector + zoom-in / zoom-out buttons for the recording timeline.
|
|
33005
|
-
* Zoom cycles through ZOOM_LEVELS (widest → narrowest),
|
|
33006
|
-
*
|
|
33007
|
-
*
|
|
33003
|
+
* Zoom cycles through ZOOM_LEVELS (widest → narrowest), anchored on the view's
|
|
33004
|
+
* RIGHT edge — so on today's timeline "now" stays pinned to the right instead
|
|
33005
|
+
* of drifting to a midday range. Horizontal pan (wheel) then moves the window
|
|
33006
|
+
* back/forward in time. Pan is wired via wheel events in RecordingTimeline.
|
|
33008
33007
|
*/
|
|
33009
33008
|
function TimelineControls({ day, onDayChange, view, dayBounds, onViewChange }) {
|
|
33010
33009
|
const handleDateChange = (e) => {
|
|
@@ -33026,16 +33025,16 @@ function TimelineControls({ day, onDayChange, view, dayBounds, onViewChange }) {
|
|
|
33026
33025
|
}
|
|
33027
33026
|
return best;
|
|
33028
33027
|
})();
|
|
33029
|
-
const
|
|
33028
|
+
const rightEdgeMs = view.toMs;
|
|
33030
33029
|
const handleZoomIn = () => {
|
|
33031
33030
|
const nextLevel = ZOOM_LEVELS[Math.min(currentLevelIdx + 1, ZOOM_LEVELS.length - 1)];
|
|
33032
33031
|
if (nextLevel === void 0) return;
|
|
33033
|
-
onViewChange(
|
|
33032
|
+
onViewChange(zoomWindowAnchoredRight(dayBounds, nextLevel, rightEdgeMs));
|
|
33034
33033
|
};
|
|
33035
33034
|
const handleZoomOut = () => {
|
|
33036
33035
|
const nextLevel = ZOOM_LEVELS[Math.max(currentLevelIdx - 1, 0)];
|
|
33037
33036
|
if (nextLevel === void 0) return;
|
|
33038
|
-
onViewChange(
|
|
33037
|
+
onViewChange(zoomWindowAnchoredRight(dayBounds, nextLevel, rightEdgeMs));
|
|
33039
33038
|
};
|
|
33040
33039
|
const canZoomIn = currentLevelIdx < ZOOM_LEVELS.length - 1;
|
|
33041
33040
|
const canZoomOut = currentLevelIdx > 0;
|