mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-13 00:26:42 +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,
|
b.timestamp - a.timestamp,
|
||||||
)[0]?.data?.zones || [];
|
)[0]?.data?.zones || [];
|
||||||
|
|
||||||
// bounding box (with tolerance for browsers with seek precision by-design issues)
|
// bounding box - only show if there's a timeline event at/near the current time with a box
|
||||||
const boxCandidates = timelineData?.filter(
|
// Search all timeline events (not just those before current time) to find one matching the seek position
|
||||||
(event: TrackingDetailsSequence) =>
|
const nearbyTimelineEvent = timelineData
|
||||||
event.timestamp <= effectiveCurrentTime + TOLERANCE &&
|
?.filter((event: TrackingDetailsSequence) => event.data.box)
|
||||||
event.data.box,
|
.sort(
|
||||||
);
|
(a: TrackingDetailsSequence, b: TrackingDetailsSequence) =>
|
||||||
const currentBox = boxCandidates?.sort(
|
Math.abs(a.timestamp - effectiveCurrentTime) -
|
||||||
(a: TrackingDetailsSequence, b: TrackingDetailsSequence) =>
|
Math.abs(b.timestamp - effectiveCurrentTime),
|
||||||
b.timestamp - a.timestamp,
|
)
|
||||||
)[0]?.data?.box;
|
.find(
|
||||||
|
(event: TrackingDetailsSequence) =>
|
||||||
|
Math.abs(event.timestamp - effectiveCurrentTime) <= TOLERANCE,
|
||||||
|
);
|
||||||
|
|
||||||
|
const currentBox = nearbyTimelineEvent?.data?.box;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
objectId,
|
objectId,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user