fix: use absolute coords when rendering link popover (#4753)
This commit is contained in:
parent
4d9dbd5a45
commit
92ffe8dda6
@ -212,8 +212,9 @@ const getCoordsForPopover = (
|
|||||||
element: NonDeletedExcalidrawElement,
|
element: NonDeletedExcalidrawElement,
|
||||||
appState: AppState,
|
appState: AppState,
|
||||||
) => {
|
) => {
|
||||||
|
const [x1, y1] = getElementAbsoluteCoords(element);
|
||||||
const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords(
|
const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords(
|
||||||
{ sceneX: element.x + element.width / 2, sceneY: element.y },
|
{ sceneX: x1 + element.width / 2, sceneY: y1 },
|
||||||
appState,
|
appState,
|
||||||
);
|
);
|
||||||
const x = viewportX - appState.offsetLeft - CONTAINER_WIDTH / 2;
|
const x = viewportX - appState.offsetLeft - CONTAINER_WIDTH / 2;
|
||||||
@ -425,13 +426,13 @@ export const shouldHideLinkPopup = (
|
|||||||
if (isPointHittingElementBoundingBox(element, [sceneX, sceneY], threshold)) {
|
if (isPointHittingElementBoundingBox(element, [sceneX, sceneY], threshold)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const [x1, y1, x2] = getElementAbsoluteCoords(element);
|
||||||
// hit box to prevent hiding when hovered in the vertical area between element and popover
|
// hit box to prevent hiding when hovered in the vertical area between element and popover
|
||||||
if (
|
if (
|
||||||
sceneX >= element.x &&
|
sceneX >= x1 &&
|
||||||
sceneX <= element.x + element.width &&
|
sceneX <= x2 &&
|
||||||
sceneY <= element.y &&
|
sceneY >= y1 - SPACE_BOTTOM &&
|
||||||
sceneY >= element.y - SPACE_BOTTOM
|
sceneY <= y1
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user