fix: use actual blip width to position tooltip
This commit is contained in:
committed by
Mathias Schopmans
parent
15664d2d92
commit
8fe400f7a2
@@ -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<RadarProps> = ({
|
||||
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({
|
||||
|
||||
Reference in New Issue
Block a user