mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-27 01:48:58 +03:00
Add zoom icons to timeline (#20717)
* add icons to zoom timeline * fix current zoom level handling * ensure mobile buttons don't stay selected * remove icons on event review timeline * add tooltips
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
ReviewData,
|
||||
ReviewSegment,
|
||||
ReviewSeverity,
|
||||
ZoomLevel,
|
||||
} from "@/types/review";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import CameraActivityIndicator from "@/components/indicators/CameraActivityIndicator";
|
||||
@@ -180,7 +181,7 @@ function UIPlayground() {
|
||||
timestampSpread: 15,
|
||||
});
|
||||
|
||||
const possibleZoomLevels = useMemo(
|
||||
const possibleZoomLevels: ZoomLevel[] = useMemo(
|
||||
() => [
|
||||
{ segmentDuration: 60, timestampSpread: 15 },
|
||||
{ segmentDuration: 30, timestampSpread: 5 },
|
||||
@@ -196,6 +197,14 @@ function UIPlayground() {
|
||||
[possibleZoomLevels],
|
||||
);
|
||||
|
||||
const currentZoomLevel = useMemo(
|
||||
() =>
|
||||
possibleZoomLevels.findIndex(
|
||||
(level) => level.segmentDuration === zoomSettings.segmentDuration,
|
||||
),
|
||||
[possibleZoomLevels, zoomSettings.segmentDuration],
|
||||
);
|
||||
|
||||
const { zoomLevel, handleZoom, isZooming, zoomDirection } = useTimelineZoom({
|
||||
zoomSettings,
|
||||
zoomLevels: possibleZoomLevels,
|
||||
@@ -414,6 +423,9 @@ function UIPlayground() {
|
||||
dense={isMobile} // dense will produce a smaller handlebar and only minute resolution on timestamps
|
||||
isZooming={isZooming} // is the timeline actively zooming?
|
||||
zoomDirection={zoomDirection} // is the timeline zooming in or out
|
||||
onZoomChange={handleZoomChange}
|
||||
possibleZoomLevels={possibleZoomLevels}
|
||||
currentZoomLevel={currentZoomLevel}
|
||||
/>
|
||||
)}
|
||||
{isEventsReviewTimeline && (
|
||||
@@ -441,6 +453,9 @@ function UIPlayground() {
|
||||
dense // dense will produce a smaller handlebar and only minute resolution on timestamps
|
||||
isZooming={isZooming} // is the timeline actively zooming?
|
||||
zoomDirection={zoomDirection} // is the timeline zooming in or out
|
||||
onZoomChange={handleZoomChange}
|
||||
possibleZoomLevels={possibleZoomLevels}
|
||||
currentZoomLevel={currentZoomLevel}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user