Editor position bugfix

This commit is contained in:
Rainer Simon 2021-02-27 18:04:58 +01:00
parent fd512a5ccf
commit 0c83d309a2
2 changed files with 3 additions and 3 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@recogito/recogito-client-core",
"version": "1.0.0",
"version": "1.0.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -13,14 +13,14 @@ const setPosition = (wrapperEl, editorEl, selectedEl) => {
// Default orientation
const { left, top, right, height } = selectedEl.getBoundingClientRect();
editorEl.style.top = `${top + height - containerBounds.top}px`;
editorEl.style.left = `${left + pageXOffset - containerBounds.left}px`;
editorEl.style.left = `${left - containerBounds.left}px`;
const defaultOrientation = editorEl.getBoundingClientRect();
if (defaultOrientation.right > window.innerWidth) {
// Default bounds clipped - flip horizontally
editorEl.classList.add('align-right');
editorEl.style.left = `${right - defaultOrientation.width + pageXOffset - containerBounds.left}px`;
editorEl.style.left = `${right - defaultOrientation.width - containerBounds.left}px`;
}
if (defaultOrientation.bottom > window.innerHeight) {