diff --git a/packages/element/src/renderElement.ts b/packages/element/src/renderElement.ts
index c8091e8ed..e749bd90c 100644
--- a/packages/element/src/renderElement.ts
+++ b/packages/element/src/renderElement.ts
@@ -349,8 +349,6 @@ const generateElementCanvas = (
};
};
-export const DEFAULT_LINK_SIZE = 14;
-
const IMAGE_PLACEHOLDER_IMG = document.createElement("img");
IMAGE_PLACEHOLDER_IMG.src = `data:${MIME_TYPES.svg},${encodeURIComponent(
``,
diff --git a/packages/excalidraw/components/hyperlink/helpers.ts b/packages/excalidraw/components/hyperlink/helpers.ts
index bdabbfc44..7d39b7ff7 100644
--- a/packages/excalidraw/components/hyperlink/helpers.ts
+++ b/packages/excalidraw/components/hyperlink/helpers.ts
@@ -4,8 +4,6 @@ import { MIME_TYPES } from "@excalidraw/common";
import { getElementAbsoluteCoords } from "@excalidraw/element";
import { hitElementBoundingBox } from "@excalidraw/element";
-import { DEFAULT_LINK_SIZE } from "@excalidraw/element";
-
import type { GlobalPoint, Radians } from "@excalidraw/math";
import type { Bounds } from "@excalidraw/element";
@@ -16,9 +14,11 @@ import type {
import type { AppState, UIAppState } from "../../types";
+export const DEFAULT_LINK_SIZE = 12;
+
export const EXTERNAL_LINK_IMG = document.createElement("img");
EXTERNAL_LINK_IMG.src = `data:${MIME_TYPES.svg}, ${encodeURIComponent(
- ``,
+ ``,
)}`;
export const ELEMENT_LINK_IMG = document.createElement("img");
@@ -32,13 +32,14 @@ export const getLinkHandleFromCoords = (
appState: Pick,
): Bounds => {
const size = DEFAULT_LINK_SIZE;
- const linkWidth = size / appState.zoom.value;
- const linkHeight = size / appState.zoom.value;
- const linkMarginY = size / appState.zoom.value;
+ const zoom = appState.zoom.value > 1 ? appState.zoom.value : 1;
+ const linkWidth = size / zoom;
+ const linkHeight = size / zoom;
+ const linkMarginY = size / zoom;
const centerX = (x1 + x2) / 2;
const centerY = (y1 + y2) / 2;
- const centeringOffset = (size - 8) / (2 * appState.zoom.value);
- const dashedLineMargin = 4 / appState.zoom.value;
+ const centeringOffset = (size - 8) / (2 * zoom);
+ const dashedLineMargin = 4 / zoom;
// Same as `ne` resize handle
const x = x2 + dashedLineMargin - centeringOffset;
diff --git a/packages/excalidraw/renderer/staticScene.ts b/packages/excalidraw/renderer/staticScene.ts
index d63779464..18cf0092d 100644
--- a/packages/excalidraw/renderer/staticScene.ts
+++ b/packages/excalidraw/renderer/staticScene.ts
@@ -188,7 +188,7 @@ const renderLinkIcon = (
window.devicePixelRatio * appState.zoom.value,
window.devicePixelRatio * appState.zoom.value,
);
- linkCanvasCacheContext.fillStyle = "#fff";
+ linkCanvasCacheContext.fillStyle = appState.viewBackgroundColor || "#fff";
linkCanvasCacheContext.fillRect(0, 0, width, height);
if (canvasKey === "elementLink") {