fix: mouse hover in heatmap

This commit is contained in:
boojack
2022-06-25 09:57:31 +08:00
parent 4871ebf24e
commit cad4db128b
3 changed files with 55 additions and 4 deletions

View File

@ -59,9 +59,9 @@ const UsageHeatMap: React.FC<Props> = () => {
return;
}
const targetEl = event.target as HTMLElement;
popupRef.current.style.left = targetEl.offsetLeft + "px";
popupRef.current.style.top = targetEl.offsetTop - 4 + "px";
const bounding = utils.getElementBounding(event.target as HTMLElement);
popupRef.current.style.left = bounding.left + "px";
popupRef.current.style.top = bounding.top - 4 + "px";
}, []);
const handleUsageStatItemMouseLeave = useCallback(() => {