Limit tooltip size to window size (#47303) (#47314)

(cherry picked from commit 910ed77e16)

Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-04-05 13:46:45 +02:00
committed by GitHub
co-authored by Oscar Kilhed
parent 3a8058ae2a
commit 80a8f2c96b
@@ -45,13 +45,13 @@ export const VizTooltipContainer: React.FC<VizTooltipContainerProps> = ({
const tH = Math.floor(entry.contentRect.height + 2 * 8);
if (tooltipMeasurement.width !== tW || tooltipMeasurement.height !== tH) {
setTooltipMeasurement({
width: tW,
height: tH,
width: Math.min(tW, width),
height: Math.min(tH, height),
});
}
}
}),
[tooltipMeasurement]
[tooltipMeasurement, width, height]
);
useLayoutEffect(() => {