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`}
|
className={`h-[2px] rounded-full bg-motion_review`}
|
||||||
onClick={segmentClick}
|
onClick={segmentClick}
|
||||||
style={{
|
style={{
|
||||||
width:
|
width: interpolateMotionAudioData(
|
||||||
maxSegmentWidth -
|
getMotionSegmentValue(segmentTime),
|
||||||
interpolateMotionAudioData(
|
0,
|
||||||
getMotionSegmentValue(segmentTime - segmentDuration / 2),
|
100,
|
||||||
0,
|
1,
|
||||||
100,
|
maxSegmentWidth,
|
||||||
1,
|
),
|
||||||
maxSegmentWidth,
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
@ -236,7 +234,7 @@ export function MotionSegment({
|
|||||||
onClick={segmentClick}
|
onClick={segmentClick}
|
||||||
style={{
|
style={{
|
||||||
width: interpolateMotionAudioData(
|
width: interpolateMotionAudioData(
|
||||||
getAudioSegmentValue(segmentTime - segmentDuration / 2),
|
getAudioSegmentValue(segmentTime),
|
||||||
-100,
|
-100,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
@ -254,15 +252,13 @@ export function MotionSegment({
|
|||||||
className={`h-[2px] rounded-full bg-motion_review`}
|
className={`h-[2px] rounded-full bg-motion_review`}
|
||||||
onClick={segmentClick}
|
onClick={segmentClick}
|
||||||
style={{
|
style={{
|
||||||
width:
|
width: interpolateMotionAudioData(
|
||||||
maxSegmentWidth -
|
getMotionSegmentValue(segmentTime - segmentDuration / 2),
|
||||||
interpolateMotionAudioData(
|
0,
|
||||||
getMotionSegmentValue(segmentTime),
|
100,
|
||||||
0,
|
1,
|
||||||
100,
|
maxSegmentWidth,
|
||||||
1,
|
),
|
||||||
maxSegmentWidth,
|
|
||||||
),
|
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
@ -273,7 +269,7 @@ export function MotionSegment({
|
|||||||
onClick={segmentClick}
|
onClick={segmentClick}
|
||||||
style={{
|
style={{
|
||||||
width: interpolateMotionAudioData(
|
width: interpolateMotionAudioData(
|
||||||
getAudioSegmentValue(segmentTime),
|
getAudioSegmentValue(segmentTime - segmentDuration / 2),
|
||||||
-100,
|
-100,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
@ -45,13 +45,13 @@ export const useMotionSegmentUtils = (
|
|||||||
const matchingEvent = motion_events.find((event) => {
|
const matchingEvent = motion_events.find((event) => {
|
||||||
return (
|
return (
|
||||||
time >= getSegmentStart(event.start_time) &&
|
time >= getSegmentStart(event.start_time) &&
|
||||||
time < getSegmentEnd(event.end_time)
|
time < getSegmentEnd(event.start_time + segmentDuration / 2)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return matchingEvent?.motionValue ?? 0;
|
return matchingEvent?.motionValue ?? 0;
|
||||||
},
|
},
|
||||||
[motion_events, getSegmentStart, getSegmentEnd],
|
[motion_events, getSegmentStart, getSegmentEnd, segmentDuration],
|
||||||
);
|
);
|
||||||
|
|
||||||
const getAudioSegmentValue = useCallback(
|
const getAudioSegmentValue = useCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user