From be0be90bdb13d66bd392fa8d655a1a1b40ff5369 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sun, 1 Nov 2026 13:15:06 -0600 Subject: [PATCH] Revert "no gray picking" This reverts commit 62637418e5fd38be5e6c32972c4ec7eedcd1adbe. --- .../Characteristics/components/StatScale.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/StatScale.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/StatScale.tsx index 4462ddb8b..0be1f2904 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/StatScale.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/StatScale.tsx @@ -16,7 +16,7 @@ export const StatScale = memo( const min = Math.min(value, ...values); const max = Math.max(value, ...values); const range = max - min; - const positions = new Set(); + const counts = new Map(); for (const other of values) { const raw = range === 0 ? 0.5 : (other - min) / range; @@ -24,10 +24,14 @@ export const StatScale = memo( if (x === 0 || x === 1) continue; - positions.add(x); + counts.set(x, (counts.get(x) ?? 0) + 1); } - return Array.from(positions); + return Array.from(counts, ([x, count]) => ({ + x, + color: + count === 1 ? "--gray-a5" : count <= 3 ? "--gray-a6" : "--gray-a7", + })); }, [values, value, lowerIsBetter]); useEffect(() => { @@ -45,8 +49,8 @@ export const StatScale = memo( context.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0); const styles = getComputedStyle(element); - context.fillStyle = styles.getPropertyValue("--gray-a5"); - for (const x of ticks) { + for (const { x, color } of ticks) { + context.fillStyle = styles.getPropertyValue(color); context.fillRect(x * width, 0, 1, HEIGHT); } };