From 4ae52179326f8d9f51d53b9e5ffe1ddaf0b89903 Mon Sep 17 00:00:00 2001 From: Thibault <54189871+Asaren1070@users.noreply.github.com> Date: Wed, 25 Jun 2025 10:56:56 +0100 Subject: [PATCH] fix: fixing the scrollbar of the individual orbital parameters history (#460) --- .../_homeComponents/HistoricalSolarCycleData.tsx | 2 +- .../satellites/[satelliteSlug]/orbitDataGraph.tsx | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/_homeComponents/HistoricalSolarCycleData.tsx b/frontend/src/app/_homeComponents/HistoricalSolarCycleData.tsx index b8b22fd..37ba821 100644 --- a/frontend/src/app/_homeComponents/HistoricalSolarCycleData.tsx +++ b/frontend/src/app/_homeComponents/HistoricalSolarCycleData.tsx @@ -100,7 +100,7 @@ export default function HistoricalSolarCycleData() { ): any { const extremes = this.axis.getExtremes(); const zoomLevel = extremes.max - extremes.min; // Get the current zoom range - if (zoomLevel <= 18 * 30 * 24 * 3600 * 1000) { + if (zoomLevel <= 8 * 12 * 30 * 24 * 3600 * 1000) { // If zoomed in to less than or equal to 1 month return Highcharts.dateFormat( "%b %Y", diff --git a/frontend/src/app/satellites/[satelliteSlug]/orbitDataGraph.tsx b/frontend/src/app/satellites/[satelliteSlug]/orbitDataGraph.tsx index affe3da..fd335cc 100644 --- a/frontend/src/app/satellites/[satelliteSlug]/orbitDataGraph.tsx +++ b/frontend/src/app/satellites/[satelliteSlug]/orbitDataGraph.tsx @@ -84,15 +84,20 @@ const OrbitDataGraph: React.FC = ({ if (periodType === "m") { scrollBarTimeFrame.current = number; SBThumbWidth = - Math.round((svgSize.width * 0.8 * number * 10) / months) / - 10; + months >= number + ? Math.round( + (svgSize.width * 0.8 * number * 10) / months, + ) / 10 + : svgSize.width * 0.8 - 40.5; setSBThumbWidth(SBThumbWidth); } else if (periodType === "y") { scrollBarTimeFrame.current = number * 12; SBThumbWidth = - Math.round( - (svgSize.width * 0.8 * number * 12 * 10) / months, - ) / 10; + months >= 12 * number + ? Math.round( + (svgSize.width * 0.8 * number * 12 * 10) / months, + ) / 10 + : svgSize.width * 0.8 - 40.5; setSBThumbWidth(SBThumbWidth); } }