Minor positioning tweak

This commit is contained in:
Rainer Simon 2021-04-18 14:51:58 +02:00
parent 4fa1e145f5
commit 9658a5aa47
1 changed files with 7 additions and 1 deletions

View File

@ -11,7 +11,7 @@ const setPosition = (wrapperEl, editorEl, selectedEl) => {
editorEl.style.opacity = 1;
// Default orientation
const { left, top, right, height } = selectedEl.getBoundingClientRect();
const { left, top, right, height, bottom } = selectedEl.getBoundingClientRect();
editorEl.style.top = `${top + height - containerBounds.top}px`;
editorEl.style.left = `${left - containerBounds.left}px`;
@ -38,6 +38,12 @@ const setPosition = (wrapperEl, editorEl, selectedEl) => {
if (currentOrientation.top < 0) {
editorEl.style.top = `${-containerBounds.top}px`;
editorEl.style.bottom = 'auto';
const shapeBottom = bottom - containerBounds.top;
const editorBottom = currentOrientation.height - containerBounds.top;
if (editorBottom > shapeBottom)
editorEl.classList.remove('align-bottom');
}
}