mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
add option to only scrollintoview initially (#10689)
This commit is contained in:
parent
6fbd272acf
commit
1cd374d3ad
@ -21,6 +21,7 @@ export type MotionReviewTimelineProps = {
|
|||||||
showHandlebar?: boolean;
|
showHandlebar?: boolean;
|
||||||
handlebarTime?: number;
|
handlebarTime?: number;
|
||||||
setHandlebarTime?: React.Dispatch<React.SetStateAction<number>>;
|
setHandlebarTime?: React.Dispatch<React.SetStateAction<number>>;
|
||||||
|
onlyInitialHandlebarScroll?: boolean;
|
||||||
motionOnly?: boolean;
|
motionOnly?: boolean;
|
||||||
showMinimap?: boolean;
|
showMinimap?: boolean;
|
||||||
minimapStartTime?: number;
|
minimapStartTime?: number;
|
||||||
@ -46,6 +47,7 @@ export function MotionReviewTimeline({
|
|||||||
showHandlebar = false,
|
showHandlebar = false,
|
||||||
handlebarTime,
|
handlebarTime,
|
||||||
setHandlebarTime,
|
setHandlebarTime,
|
||||||
|
onlyInitialHandlebarScroll = false,
|
||||||
motionOnly = false,
|
motionOnly = false,
|
||||||
showMinimap = false,
|
showMinimap = false,
|
||||||
minimapStartTime,
|
minimapStartTime,
|
||||||
@ -114,6 +116,7 @@ export function MotionReviewTimeline({
|
|||||||
showDraggableElement: showHandlebar,
|
showDraggableElement: showHandlebar,
|
||||||
draggableElementTime: handlebarTime,
|
draggableElementTime: handlebarTime,
|
||||||
setDraggableElementTime: setHandlebarTime,
|
setDraggableElementTime: setHandlebarTime,
|
||||||
|
initialScrollIntoViewOnly: onlyInitialHandlebarScroll,
|
||||||
timelineDuration,
|
timelineDuration,
|
||||||
timelineCollapsed: motionOnly,
|
timelineCollapsed: motionOnly,
|
||||||
timelineStartAligned,
|
timelineStartAligned,
|
||||||
|
@ -13,6 +13,7 @@ type DraggableElementProps = {
|
|||||||
draggableElementEarliestTime?: number;
|
draggableElementEarliestTime?: number;
|
||||||
draggableElementLatestTime?: number;
|
draggableElementLatestTime?: number;
|
||||||
setDraggableElementTime?: React.Dispatch<React.SetStateAction<number>>;
|
setDraggableElementTime?: React.Dispatch<React.SetStateAction<number>>;
|
||||||
|
initialScrollIntoViewOnly?: boolean;
|
||||||
draggableElementTimeRef: React.MutableRefObject<HTMLDivElement | null>;
|
draggableElementTimeRef: React.MutableRefObject<HTMLDivElement | null>;
|
||||||
timelineDuration: number;
|
timelineDuration: number;
|
||||||
timelineCollapsed?: boolean;
|
timelineCollapsed?: boolean;
|
||||||
@ -32,6 +33,7 @@ function useDraggableElement({
|
|||||||
draggableElementEarliestTime,
|
draggableElementEarliestTime,
|
||||||
draggableElementLatestTime,
|
draggableElementLatestTime,
|
||||||
setDraggableElementTime,
|
setDraggableElementTime,
|
||||||
|
initialScrollIntoViewOnly,
|
||||||
draggableElementTimeRef,
|
draggableElementTimeRef,
|
||||||
timelineDuration,
|
timelineDuration,
|
||||||
timelineCollapsed,
|
timelineCollapsed,
|
||||||
@ -42,6 +44,7 @@ function useDraggableElement({
|
|||||||
}: DraggableElementProps) {
|
}: DraggableElementProps) {
|
||||||
const [clientYPosition, setClientYPosition] = useState<number | null>(null);
|
const [clientYPosition, setClientYPosition] = useState<number | null>(null);
|
||||||
const [initialClickAdjustment, setInitialClickAdjustment] = useState(0);
|
const [initialClickAdjustment, setInitialClickAdjustment] = useState(0);
|
||||||
|
const [elementScrollIntoView, setElementScrollIntoView] = useState(true);
|
||||||
const [scrollEdgeSize, setScrollEdgeSize] = useState<number>();
|
const [scrollEdgeSize, setScrollEdgeSize] = useState<number>();
|
||||||
const [segments, setSegments] = useState<HTMLDivElement[]>([]);
|
const [segments, setSegments] = useState<HTMLDivElement[]>([]);
|
||||||
const { alignStartDateToTimeline, getCumulativeScrollTop } = useTimelineUtils(
|
const { alignStartDateToTimeline, getCumulativeScrollTop } = useTimelineUtils(
|
||||||
@ -397,9 +400,13 @@ function useDraggableElement({
|
|||||||
updateDraggableElementPosition(
|
updateDraggableElementPosition(
|
||||||
newElementPosition,
|
newElementPosition,
|
||||||
draggableElementTime,
|
draggableElementTime,
|
||||||
true,
|
elementScrollIntoView,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (initialScrollIntoViewOnly) {
|
||||||
|
setElementScrollIntoView(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we know that these deps are correct
|
// we know that these deps are correct
|
||||||
@ -413,6 +420,7 @@ function useDraggableElement({
|
|||||||
timelineStartAligned,
|
timelineStartAligned,
|
||||||
timelineRef,
|
timelineRef,
|
||||||
timelineCollapsed,
|
timelineCollapsed,
|
||||||
|
initialScrollIntoViewOnly,
|
||||||
segments,
|
segments,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -344,6 +344,7 @@ export function RecordingView({
|
|||||||
showHandlebar
|
showHandlebar
|
||||||
handlebarTime={currentTime}
|
handlebarTime={currentTime}
|
||||||
setHandlebarTime={setCurrentTime}
|
setHandlebarTime={setCurrentTime}
|
||||||
|
onlyInitialHandlebarScroll={true}
|
||||||
events={mainCameraReviewItems}
|
events={mainCameraReviewItems}
|
||||||
motion_events={motionData ?? []}
|
motion_events={motionData ?? []}
|
||||||
severityType="significant_motion"
|
severityType="significant_motion"
|
||||||
|
Loading…
Reference in New Issue
Block a user