Skip to content

Commit 22e1839

Browse files
fix: make movemap circles bigger
1 parent edc9145 commit 22e1839

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

src/components/Analysis/MoveMap.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ScatterChart,
88
CartesianGrid,
99
ResponsiveContainer,
10+
ZAxis,
1011
} from 'recharts'
1112
import { useContext, useState, useEffect } from 'react'
1213
import { ColorSanMapping } from 'src/types'
@@ -352,24 +353,18 @@ export const MoveMap: React.FC<Props> = ({
352353
dy={getLikelyLabelDy()}
353354
/>
354355
</YAxis>
355-
{moveMap?.map((entry, index) => {
356-
// Set minimum opacity to 0.5 to ensure visibility
357-
const opacity = Math.max(entry.opacity ?? 1, 0.5)
358-
const size = entry.size ?? (isMobile ? 8 : 10)
359-
const baseColor = colorSanMapping[entry.move]?.color ?? '#fff'
360-
const fillColor = baseColor.startsWith('#')
361-
? hexToRgba(baseColor, opacity)
362-
: baseColor
356+
<ZAxis dataKey="z" type="number" range={[100, 101]} />
357+
<Scatter data={moveMap || []} fill="#fff">
358+
{moveMap?.map((entry, index) => {
359+
const opacity = Math.max(entry.opacity ?? 1, 0.5)
360+
const baseColor = colorSanMapping[entry.move]?.color ?? '#fff'
361+
const fillColor = baseColor.startsWith('#')
362+
? hexToRgba(baseColor, opacity)
363+
: baseColor
363364

364-
return (
365-
<Scatter
366-
key={`scatter-${entry.move}${index}`}
367-
name={`Move-${entry.move}`}
368-
data={[entry]}
369-
fill={fillColor}
370-
r={size}
371-
>
365+
return (
372366
<Cell
367+
key={`cell-${entry.move}${index}`}
373368
fill={fillColor}
374369
onMouseEnter={(event) =>
375370
onMouseEnter(entry.move, entry, event)
@@ -380,9 +375,9 @@ export const MoveMap: React.FC<Props> = ({
380375
}
381376
style={{ cursor: 'pointer' }}
382377
/>
383-
</Scatter>
384-
)
385-
})}
378+
)
379+
})}
380+
</Scatter>
386381
</ScatterChart>
387382
</ResponsiveContainer>
388383

src/hooks/useAnalysisController/useMoveRecommendations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ export const useMoveRecommendations = (
149149
const importance = normalizedCp + normalizedProb
150150

151151
// Calculate dynamic size based on importance (bigger = more important)
152-
// Increased size range from 4-12 to 6-16 for better visibility
153-
const size = Math.max(6, Math.min(16, 6 + importance * 6)) // 6-16px range
152+
const size = 10
154153

155154
// Get additional data for comprehensive tooltip
156155
const rawCp = moveEvaluation.stockfish.cp_vec[move] || 0
@@ -161,6 +160,7 @@ export const useMoveRecommendations = (
161160
move,
162161
x: cp,
163162
y: prob,
163+
z: 100,
164164
opacity,
165165
importance,
166166
size,

0 commit comments

Comments
 (0)