Limit tooltip size to window size (#47303)
This commit is contained in:
@@ -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(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user