From 67543ef9be47c0b3390daa1cb68ea22f782d19f9 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 6 Oct 2021 13:59:25 +0100 Subject: [PATCH] Fix drag and drop indicator positioning when not using desktop preview --- .../components/preview/DNDPositionIndicator.svelte | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/client/src/components/preview/DNDPositionIndicator.svelte b/packages/client/src/components/preview/DNDPositionIndicator.svelte index e849ab0313..011b386282 100644 --- a/packages/client/src/components/preview/DNDPositionIndicator.svelte +++ b/packages/client/src/components/preview/DNDPositionIndicator.svelte @@ -17,7 +17,17 @@ if (!bounds || !side) { return null } - const { left, top, width, height } = bounds + + // Get preview offset + const root = document.getElementById("clip-root") + const rootBounds = root.getBoundingClientRect() + + // Subtract preview offset from bounds + let { left, top, width, height } = bounds + left -= rootBounds.left + top -= rootBounds.top + + // Determine position if (side === Sides.Top || side === Sides.Bottom) { return { top: side === Sides.Top ? top - 4 : top + height,