From 15bbc788473c384fc3ed28f6476325de3a6cf6e0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 18 Oct 2022 16:18:22 +0100 Subject: [PATCH] Add grid functionality separately to DND --- .../client/src/components/Component.svelte | 5 +- .../client/src/components/app/Grid.svelte | 45 +- .../src/components/preview/DNDHandler.svelte | 39 +- .../components/preview/GridDNDHandler.svelte | 656 ++++-------------- .../components/preview/HoverIndicator.svelte | 4 +- .../src/components/preview/Indicator.svelte | 72 +- .../components/preview/IndicatorSet.svelte | 21 + .../preview/SelectionIndicator.svelte | 5 +- .../src/components/preview/SettingsBar.svelte | 4 +- packages/client/src/index.js | 2 - packages/client/src/stores/builder.js | 7 + packages/client/src/stores/dnd.js | 12 - packages/client/src/stores/index.js | 1 - 13 files changed, 251 insertions(+), 622 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 742b93bb42..fe99c3e4cd 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -21,7 +21,6 @@ devToolsStore, componentStore, appStore, - dndIsDragging, dndComponentPath, } from "stores" import { Helpers } from "@budibase/bbui" @@ -163,7 +162,7 @@ // nested layers. Only reset this when dragging stops. let pad = false $: pad = pad || (interactive && hasChildren && inDndPath) - $: $dndIsDragging, (pad = false) + $: $builderStore.dragging, (pad = false) // Update component context $: store.set({ @@ -427,7 +426,7 @@ const scrollIntoView = () => { // Don't scroll into view if we selected this component because we were // starting dragging on it - if (get(dndIsDragging)) { + if (get(builderStore).dragging) { return } const node = document.getElementsByClassName(id)?.[0]?.children[0] diff --git a/packages/client/src/components/app/Grid.svelte b/packages/client/src/components/app/Grid.svelte index 51c5162386..9a588dbf17 100644 --- a/packages/client/src/components/app/Grid.svelte +++ b/packages/client/src/components/app/Grid.svelte @@ -1,11 +1,14 @@ -
+
{#each coords as coord}
{/each}
- {#if $builderStore.isDragging} -
- {#each coords as coord} -
- {/each} -
- {/if}
+{#if $builderStore.inBuilder && node} + +{/if} +