From 9658a5aa47c8d148d0d4d4201dc92324ee62260c Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Sun, 18 Apr 2021 14:51:58 +0200 Subject: [PATCH] Minor positioning tweak --- src/editor/setPosition.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/editor/setPosition.js b/src/editor/setPosition.js index fe7fb9f..140f107 100644 --- a/src/editor/setPosition.js +++ b/src/editor/setPosition.js @@ -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'); } }