Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: link popup position not accounting for offsets (#4695)

David Luzarde6371aac422
diff --git a/src/element/Hyperlink.tsx b/src/element/Hyperlink.tsx
index 261b58a59a..884ef6cea6 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 };
};