From b528c9fa082e9248984e0a045ec569d976be5e57 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 6 Apr 2022 14:32:25 +0100 Subject: [PATCH] Account for builder preview 2px offset when rendering indicator sets so that indicators are accurate for devtools --- packages/client/src/components/preview/IndicatorSet.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/preview/IndicatorSet.svelte b/packages/client/src/components/preview/IndicatorSet.svelte index 012aa7e470..6fcf552d21 100644 --- a/packages/client/src/components/preview/IndicatorSet.svelte +++ b/packages/client/src/components/preview/IndicatorSet.svelte @@ -2,6 +2,7 @@ import { onMount, onDestroy } from "svelte" import Indicator from "./Indicator.svelte" import { domDebounce } from "utils/domDebounce" + import { builderStore } from "stores" export let componentId export let color @@ -13,6 +14,7 @@ let interval let text $: visibleIndicators = indicators.filter(x => x.visible) + $: offset = $builderStore.inBuilder ? 0 : 2 let updating = false let observers = [] @@ -88,8 +90,8 @@ const elBounds = child.getBoundingClientRect() nextIndicators.push({ - top: elBounds.top + scrollY - deviceBounds.top, - left: elBounds.left + scrollX - deviceBounds.left, + top: elBounds.top + scrollY - deviceBounds.top - offset, + left: elBounds.left + scrollX - deviceBounds.left - offset, width: elBounds.width + 4, height: elBounds.height + 4, visible: false,