Limit tooltip size to window size (#47303)

This commit is contained in:
Oscar Kilhed
2022-04-05 13:35:02 +02:00
committed by GitHub
parent 6a059dcb4d
commit 910ed77e16
@@ -45,13 +45,13 @@ export const VizTooltipContainer: React.FC<VizTooltipContainerProps> = ({
const tH = Math.floor(entry.contentRect.height + 2 * 8); const tH = Math.floor(entry.contentRect.height + 2 * 8);
if (tooltipMeasurement.width !== tW || tooltipMeasurement.height !== tH) { if (tooltipMeasurement.width !== tW || tooltipMeasurement.height !== tH) {
setTooltipMeasurement({ setTooltipMeasurement({
width: tW, width: Math.min(tW, width),
height: tH, height: Math.min(tH, height),
}); });
} }
} }
}), }),
[tooltipMeasurement] [tooltipMeasurement, width, height]
); );
useLayoutEffect(() => { useLayoutEffect(() => {