From bfc5e038611a7cbf400c7d202e1cb5c1cb3fb3c6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 10 Jun 2021 15:13:51 +0100 Subject: [PATCH] Use IntersectionObservers to determine visibility of selected and hovered components --- .../client/src/components/ClientApp.svelte | 13 ++- .../src/components/HoverIndicator.svelte | 60 +--------- .../client/src/components/Indicator.svelte | 13 ++- .../client/src/components/IndicatorSet.svelte | 110 ++++++++++++++++++ .../src/components/SelectionIndicator.svelte | 59 ++-------- 5 files changed, 139 insertions(+), 116 deletions(-) create mode 100644 packages/client/src/components/IndicatorSet.svelte diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 01bbe6c9af..7bdab63102 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -68,13 +68,20 @@ + {#key $builderStore.selectedComponentId} - {#if $builderStore.inBuilder && $builderStore.selectedComponent} + {#if $builderStore.inBuilder} - - {/if} {/key} + + {#if $builderStore.inBuilder} + + + {/if} {/if} diff --git a/packages/client/src/components/HoverIndicator.svelte b/packages/client/src/components/HoverIndicator.svelte index bb5db38d73..55e6876190 100644 --- a/packages/client/src/components/HoverIndicator.svelte +++ b/packages/client/src/components/HoverIndicator.svelte @@ -1,86 +1,32 @@ -{#key componentId} - {#if componentId !== $builderStore.selectedComponentId} - {#each indicators as indicator, idx} - - {/each} - {/if} -{/key} + diff --git a/packages/client/src/components/Indicator.svelte b/packages/client/src/components/Indicator.svelte index b47d5ee4ba..fb1b5f320f 100644 --- a/packages/client/src/components/Indicator.svelte +++ b/packages/client/src/components/Indicator.svelte @@ -7,13 +7,18 @@ export let height export let text export let color + export let zIndex export let transition = false
{#if text}
@@ -24,8 +29,8 @@