forked from Github/frigate
Timeline minimap and scrolling changes (#10589)
* add function to get visible timeline duration * Don't show minimap when minimap bounds exceed timeline area * when minimap is hidden, only scroll timeline when needed * observe only when not showing minimap * no need to duplicate observer * fix out of order param * timeline utils hook props --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
@@ -39,18 +39,22 @@ export function SummaryTimeline({
|
||||
|
||||
const observer = useRef<ResizeObserver | null>(null);
|
||||
|
||||
const { alignStartDateToTimeline } = useTimelineUtils(segmentDuration);
|
||||
const reviewTimelineDuration = useMemo(
|
||||
() => timelineStart - timelineEnd + 4 * segmentDuration,
|
||||
[timelineEnd, timelineStart, segmentDuration],
|
||||
);
|
||||
|
||||
const { alignStartDateToTimeline } = useTimelineUtils({
|
||||
segmentDuration,
|
||||
timelineDuration: reviewTimelineDuration,
|
||||
timelineRef: reviewTimelineRef,
|
||||
});
|
||||
|
||||
const timelineStartAligned = useMemo(
|
||||
() => alignStartDateToTimeline(timelineStart) + 2 * segmentDuration,
|
||||
[timelineStart, alignStartDateToTimeline, segmentDuration],
|
||||
);
|
||||
|
||||
const reviewTimelineDuration = useMemo(
|
||||
() => timelineStart - timelineEnd + 4 * segmentDuration,
|
||||
[timelineEnd, timelineStart, segmentDuration],
|
||||
);
|
||||
|
||||
// Generate segments for the timeline
|
||||
const generateSegments = useCallback(() => {
|
||||
const segmentCount = reviewTimelineDuration / segmentDuration;
|
||||
|
||||
Reference in New Issue
Block a user