mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-11 07:45:41 +03:00
fix bounding box display to only show on actual points that have a box
This commit is contained in:
parent
7826029a9d
commit
f0e1d02f14
@ -239,16 +239,21 @@ export default function ObjectTrackOverlay({
|
||||
b.timestamp - a.timestamp,
|
||||
)[0]?.data?.zones || [];
|
||||
|
||||
// bounding box (with tolerance for browsers with seek precision by-design issues)
|
||||
const boxCandidates = timelineData?.filter(
|
||||
(event: TrackingDetailsSequence) =>
|
||||
event.timestamp <= effectiveCurrentTime + TOLERANCE &&
|
||||
event.data.box,
|
||||
);
|
||||
const currentBox = boxCandidates?.sort(
|
||||
(a: TrackingDetailsSequence, b: TrackingDetailsSequence) =>
|
||||
b.timestamp - a.timestamp,
|
||||
)[0]?.data?.box;
|
||||
// bounding box - only show if there's a timeline event at/near the current time with a box
|
||||
// Search all timeline events (not just those before current time) to find one matching the seek position
|
||||
const nearbyTimelineEvent = timelineData
|
||||
?.filter((event: TrackingDetailsSequence) => event.data.box)
|
||||
.sort(
|
||||
(a: TrackingDetailsSequence, b: TrackingDetailsSequence) =>
|
||||
Math.abs(a.timestamp - effectiveCurrentTime) -
|
||||
Math.abs(b.timestamp - effectiveCurrentTime),
|
||||
)
|
||||
.find(
|
||||
(event: TrackingDetailsSequence) =>
|
||||
Math.abs(event.timestamp - effectiveCurrentTime) <= TOLERANCE,
|
||||
);
|
||||
|
||||
const currentBox = nearbyTimelineEvent?.data?.box;
|
||||
|
||||
return {
|
||||
objectId,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user