Editor position bugfix
This commit is contained in:
parent
fd512a5ccf
commit
0c83d309a2
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@recogito/recogito-client-core",
|
"name": "@recogito/recogito-client-core",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -13,14 +13,14 @@ const setPosition = (wrapperEl, editorEl, selectedEl) => {
|
||||||
// Default orientation
|
// Default orientation
|
||||||
const { left, top, right, height } = selectedEl.getBoundingClientRect();
|
const { left, top, right, height } = selectedEl.getBoundingClientRect();
|
||||||
editorEl.style.top = `${top + height - containerBounds.top}px`;
|
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();
|
const defaultOrientation = editorEl.getBoundingClientRect();
|
||||||
|
|
||||||
if (defaultOrientation.right > window.innerWidth) {
|
if (defaultOrientation.right > window.innerWidth) {
|
||||||
// Default bounds clipped - flip horizontally
|
// Default bounds clipped - flip horizontally
|
||||||
editorEl.classList.add('align-right');
|
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) {
|
if (defaultOrientation.bottom > window.innerHeight) {
|
||||||
|
|
Loading…
Reference in New Issue