Account for builder preview 2px offset when rendering indicator sets so that indicators are accurate for devtools
This commit is contained in:
parent
caff2d7508
commit
b528c9fa08
|
@ -2,6 +2,7 @@
|
||||||
import { onMount, onDestroy } from "svelte"
|
import { onMount, onDestroy } from "svelte"
|
||||||
import Indicator from "./Indicator.svelte"
|
import Indicator from "./Indicator.svelte"
|
||||||
import { domDebounce } from "utils/domDebounce"
|
import { domDebounce } from "utils/domDebounce"
|
||||||
|
import { builderStore } from "stores"
|
||||||
|
|
||||||
export let componentId
|
export let componentId
|
||||||
export let color
|
export let color
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
let interval
|
let interval
|
||||||
let text
|
let text
|
||||||
$: visibleIndicators = indicators.filter(x => x.visible)
|
$: visibleIndicators = indicators.filter(x => x.visible)
|
||||||
|
$: offset = $builderStore.inBuilder ? 0 : 2
|
||||||
|
|
||||||
let updating = false
|
let updating = false
|
||||||
let observers = []
|
let observers = []
|
||||||
|
@ -88,8 +90,8 @@
|
||||||
|
|
||||||
const elBounds = child.getBoundingClientRect()
|
const elBounds = child.getBoundingClientRect()
|
||||||
nextIndicators.push({
|
nextIndicators.push({
|
||||||
top: elBounds.top + scrollY - deviceBounds.top,
|
top: elBounds.top + scrollY - deviceBounds.top - offset,
|
||||||
left: elBounds.left + scrollX - deviceBounds.left,
|
left: elBounds.left + scrollX - deviceBounds.left - offset,
|
||||||
width: elBounds.width + 4,
|
width: elBounds.width + 4,
|
||||||
height: elBounds.height + 4,
|
height: elBounds.height + 4,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
|
Loading…
Reference in New Issue