Enhancements to editor auto-position

This commit is contained in:
Rainer Simon 2021-04-18 14:33:19 +02:00
parent 28b8c33f9b
commit 4fa1e145f5
1 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,14 @@ const setPosition = (wrapperEl, editorEl, selectedEl) => {
editorEl.style.top = 'auto';
editorEl.style.bottom = `${containerHeight - annotationTop}px`;
}
// Check if vertical flipping helped, push down if not
const currentOrientation = editorEl.children[1].getBoundingClientRect();
if (currentOrientation.top < 0) {
editorEl.style.top = `${-containerBounds.top}px`;
editorEl.style.bottom = 'auto';
}
}
export default setPosition;