mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
adjust segment math
This commit is contained in:
parent
282c92c9c8
commit
a4c406c911
@ -217,15 +217,13 @@ export function MotionSegment({
|
||||
className={`h-[2px] rounded-full bg-motion_review`}
|
||||
onClick={segmentClick}
|
||||
style={{
|
||||
width:
|
||||
maxSegmentWidth -
|
||||
interpolateMotionAudioData(
|
||||
getMotionSegmentValue(segmentTime - segmentDuration / 2),
|
||||
0,
|
||||
100,
|
||||
1,
|
||||
maxSegmentWidth,
|
||||
),
|
||||
width: interpolateMotionAudioData(
|
||||
getMotionSegmentValue(segmentTime),
|
||||
0,
|
||||
100,
|
||||
1,
|
||||
maxSegmentWidth,
|
||||
),
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
@ -236,7 +234,7 @@ export function MotionSegment({
|
||||
onClick={segmentClick}
|
||||
style={{
|
||||
width: interpolateMotionAudioData(
|
||||
getAudioSegmentValue(segmentTime - segmentDuration / 2),
|
||||
getAudioSegmentValue(segmentTime),
|
||||
-100,
|
||||
0,
|
||||
1,
|
||||
@ -254,15 +252,13 @@ export function MotionSegment({
|
||||
className={`h-[2px] rounded-full bg-motion_review`}
|
||||
onClick={segmentClick}
|
||||
style={{
|
||||
width:
|
||||
maxSegmentWidth -
|
||||
interpolateMotionAudioData(
|
||||
getMotionSegmentValue(segmentTime),
|
||||
0,
|
||||
100,
|
||||
1,
|
||||
maxSegmentWidth,
|
||||
),
|
||||
width: interpolateMotionAudioData(
|
||||
getMotionSegmentValue(segmentTime - segmentDuration / 2),
|
||||
0,
|
||||
100,
|
||||
1,
|
||||
maxSegmentWidth,
|
||||
),
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
@ -273,7 +269,7 @@ export function MotionSegment({
|
||||
onClick={segmentClick}
|
||||
style={{
|
||||
width: interpolateMotionAudioData(
|
||||
getAudioSegmentValue(segmentTime),
|
||||
getAudioSegmentValue(segmentTime - segmentDuration / 2),
|
||||
-100,
|
||||
0,
|
||||
1,
|
||||
|
@ -45,13 +45,13 @@ export const useMotionSegmentUtils = (
|
||||
const matchingEvent = motion_events.find((event) => {
|
||||
return (
|
||||
time >= getSegmentStart(event.start_time) &&
|
||||
time < getSegmentEnd(event.end_time)
|
||||
time < getSegmentEnd(event.start_time + segmentDuration / 2)
|
||||
);
|
||||
});
|
||||
|
||||
return matchingEvent?.motionValue ?? 0;
|
||||
},
|
||||
[motion_events, getSegmentStart, getSegmentEnd],
|
||||
[motion_events, getSegmentStart, getSegmentEnd, segmentDuration],
|
||||
);
|
||||
|
||||
const getAudioSegmentValue = useCallback(
|
||||
|
Loading…
Reference in New Issue
Block a user