popup alignment fixed when body overflows

This commit is contained in:
NikolaBorislavovHristov 2018-11-27 17:25:16 +02:00
parent 575ce81f86
commit 4c64a8297e

View file

@ -62,10 +62,10 @@ class Popup extends Component {
const menuRect = this.menuRef.current.getBoundingClientRect();
const labelRect = this.labelRef.current.getBoundingClientRect();
const labelPosition = {
left: labelRect.x,
top: labelRect.y,
right: bodyRect.width - (labelRect.x + labelRect.width),
bottom: bodyRect.height - (labelRect.y + labelRect.height)
left: labelRect.x - bodyRect.x,
top: labelRect.y - bodyRect.y,
right: (bodyRect.width + bodyRect.x) - (labelRect.x + labelRect.width),
bottom: (bodyRect.height + bodyRect.y) - (labelRect.y + labelRect.height)
};
if (menuRect.height <= labelPosition.bottom) {