Skip to content
Snippets Groups Projects
Commit ddacdd30 authored by chris's avatar chris
Browse files

overlay position

parent b5d111e7
No related branches found
No related tags found
1 merge request!493Fix ai
......@@ -112,14 +112,18 @@ const AskAIOverlay = ({ setPosition, position, config }) => {
const WaxSurface = activeView.dom.getBoundingClientRect();
const { selection } = activeView.state;
const { to } = selection;
const end = activeView.coordsAtPos(to);
// const overLayComponent = document.getElementById('ai-overlay');
// let overLayComponentCoords;
// if (overLayComponent)
// overLayComponentCoords = overLayComponent.getBoundingClientRect();
const end = activeView.coordsAtPos(to - 1);
const overLayComponent = document.getElementById('ai-overlay');
const overLayComponentCoords = overLayComponent.getBoundingClientRect();
const top = end.top - WaxSurface.top + 20;
// const left = end.left - WaxSurface.left - overLayComponentCoords.width / 2;
const left = end.left - WaxSurface.left - 50;
let left = end.left - WaxSurface.left;
// Don't get out of right boundary of the surface
if (end.left + overLayComponentCoords.width > WaxSurface.right) {
left -= end.left + overLayComponentCoords.width - WaxSurface.right;
}
setPosition({ ...position, left, top });
}, [position.left]);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment