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 }) => { ...@@ -112,14 +112,18 @@ const AskAIOverlay = ({ setPosition, position, config }) => {
const WaxSurface = activeView.dom.getBoundingClientRect(); const WaxSurface = activeView.dom.getBoundingClientRect();
const { selection } = activeView.state; const { selection } = activeView.state;
const { to } = selection; const { to } = selection;
const end = activeView.coordsAtPos(to); const end = activeView.coordsAtPos(to - 1);
// const overLayComponent = document.getElementById('ai-overlay'); const overLayComponent = document.getElementById('ai-overlay');
// let overLayComponentCoords;
// if (overLayComponent) const overLayComponentCoords = overLayComponent.getBoundingClientRect();
// overLayComponentCoords = overLayComponent.getBoundingClientRect();
const top = end.top - WaxSurface.top + 20; const top = end.top - WaxSurface.top + 20;
// const left = end.left - WaxSurface.left - overLayComponentCoords.width / 2; let left = end.left - WaxSurface.left;
const left = end.left - WaxSurface.left - 50;
// 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 }); setPosition({ ...position, left, top });
}, [position.left]); }, [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