diff --git a/src/element/Hyperlink.tsx b/src/element/Hyperlink.tsx index 261b58a5..884ef6ce 100644 --- a/src/element/Hyperlink.tsx +++ b/src/element/Hyperlink.tsx @@ -197,12 +197,12 @@ const getCoordsForPopover = ( element: NonDeletedExcalidrawElement, appState: AppState, ) => { - const { x: viewPortX, y: viewPortY } = sceneCoordsToViewportCoords( + const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords( { sceneX: element.x + element.width / 2, sceneY: element.y }, appState, ); - const x = viewPortX - CONTAINER_WIDTH / 2; - const y = viewPortY - SPACE_BOTTOM; + const x = viewportX - appState.offsetLeft - CONTAINER_WIDTH / 2; + const y = viewportY - appState.offsetTop - SPACE_BOTTOM; return { x, y }; };