Don't show minimap when minimap bounds exceed timeline area

This commit is contained in:
Nicolas Mowen 2024-03-21 08:45:29 -06:00
parent ca85c317e8
commit ab9c2004e0

View File

@ -384,11 +384,8 @@ function DetectionReview({
[timeRange], [timeRange],
); );
const { alignStartDateToTimeline } = useTimelineUtils( const { alignStartDateToTimeline, getVisibleTimelineDuration } =
segmentDuration, useTimelineUtils(segmentDuration, timelineDuration, reviewTimelineRef);
timelineDuration,
reviewTimelineRef,
);
const scrollLock = useScrollLockout(contentRef); const scrollLock = useScrollLockout(contentRef);
@ -457,10 +454,21 @@ function DetectionReview({
return false; return false;
} }
return contentRef.current.scrollHeight > contentRef.current.clientHeight; // don't show minimap if the view is not scrollable
if (contentRef.current.scrollHeight < contentRef.current.clientHeight) {
return false;
}
const visibleTime = getVisibleTimelineDuration();
const minimapTime = minimapBounds.end - minimapBounds.start;
if (visibleTime && minimapTime >= visibleTime * 0.75) {
return false;
}
return true;
// we know that these deps are correct // we know that these deps are correct
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [contentRef.current?.scrollHeight, severity]); }, [contentRef.current?.scrollHeight, minimapBounds]);
return ( return (
<> <>