Skip to content

NVR with realtime local object detection for IP cameras

Make all object path points clickable (#17367)

Josh Hawkins2c3ea5b74e3e
diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx
index c359ee91d2..0f77ecfbff 100644
--- a/web/src/components/overlay/detail/ObjectLifecycle.tsx
+++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx
@@ -285,9 +285,16 @@ export default function ObjectLifecycle({
useEffect(() => {
if (eventSequence && eventSequence.length > 0) {
- setTimeIndex(eventSequence?.[current].timestamp);
- handleSetBox(eventSequence?.[current].data.box ?? []);
- setLifecycleZones(eventSequence?.[current].data.zones);
+ if (current == -1) {
+ // normal path point
+ setBoxStyle(null);
+ setLifecycleZones([]);
+ } else {
+ // lifecycle point
+ setTimeIndex(eventSequence?.[current].timestamp);
+ handleSetBox(eventSequence?.[current].data.box ?? []);
+ setLifecycleZones(eventSequence?.[current].data.zones);
+ }
setSelectedZone("");
}
}, [current, imgLoaded, handleSetBox, eventSequence]);
@@ -322,6 +329,10 @@ export default function ObjectLifecycle({
mainApi.scrollTo(sequenceIndex);
thumbnailApi.scrollTo(sequenceIndex);
setCurrent(sequenceIndex);
+ } else {
+ // click on a normal path point, not a lifecycle point
+ setCurrent(-1);
+ setTimeIndex(pathPoints[index].timestamp);
}
},
[mainApi, thumbnailApi, eventSequence, pathPoints],
diff --git a/web/src/components/overlay/detail/ObjectPath.tsx b/web/src/components/overlay/detail/ObjectPath.tsx
index 80f4544705..f8ee020806 100644
--- a/web/src/components/overlay/detail/ObjectPath.tsx
+++ b/web/src/components/overlay/detail/ObjectPath.tsx
@@ -95,10 +95,8 @@ export function ObjectPath({
fill={getPointColor(color, pos.lifecycle_item?.class_type)}
stroke="white"
strokeWidth={width / 2}
- onClick={() =>
- pos.lifecycle_item && onPointClick && onPointClick(index)
- }
- style={{ cursor: pos.lifecycle_item ? "pointer" : "default" }}
+ onClick={() => onPointClick && onPointClick(index)}
+ style={{ cursor: "pointer" }}
/>
</TooltipTrigger>
<TooltipPortal>