From 8fe400f7a25af08c9f828ef6d3b945757db2b80c Mon Sep 17 00:00:00 2001 From: Mathias Schopmans Date: Mon, 26 Feb 2024 12:09:06 +0100 Subject: [PATCH] fix: use actual blip width to position tooltip --- src/components/Radar/Radar.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/Radar/Radar.tsx b/src/components/Radar/Radar.tsx index e5b7da3..5ab4e98 100644 --- a/src/components/Radar/Radar.tsx +++ b/src/components/Radar/Radar.tsx @@ -11,13 +11,9 @@ import styles from "./Radar.module.css"; import { Chart } from "@/components/Radar/Chart"; import { Label } from "@/components/Radar/Label"; -import { getChartConfig } from "@/lib/data"; import { Item, Quadrant, Ring } from "@/lib/types"; import { cn } from "@/lib/utils"; -const { blipSize } = getChartConfig(); -const halfBlipSize = blipSize / 2; - export interface RadarProps { size?: number; quadrants: Quadrant[]; @@ -60,7 +56,7 @@ export const Radar: FC = ({ const radarRect = radarRef.current!.getBoundingClientRect(); // Adjusting tooltip position to be relative to the radar container - const x = linkRect.left - radarRect.left + halfBlipSize; + const x = linkRect.left - radarRect.left + linkRect.width / 2; const y = linkRect.top - radarRect.top; setTooltip({