changes from code review

This commit is contained in:
Michael Shanks 2020-08-13 10:15:09 +01:00
parent 68eb3a8911
commit b6e6a1ef4b
2 changed files with 6 additions and 13 deletions

View File

@ -11,6 +11,8 @@
export let screens = [] export let screens = []
const dragDropStore = writable({})
let confirmDeleteDialog let confirmDeleteDialog
let componentToDelete = "" let componentToDelete = ""
@ -62,7 +64,7 @@
<ComponentsHierarchyChildren <ComponentsHierarchyChildren
components={screen.props._children} components={screen.props._children}
currentComponent={$store.currentComponentInfo} currentComponent={$store.currentComponentInfo}
dragDropStore={writable({})} /> {dragDropStore} />
{/if} {/if}
{/each} {/each}

View File

@ -107,7 +107,7 @@
{#each components as component, index (component._id)} {#each components as component, index (component._id)}
<li on:click|stopPropagation={() => selectComponent(component)}> <li on:click|stopPropagation={() => selectComponent(component)}>
{#if $dragDropStore && $dragDropStore.targetComponent === component && $dragDropStore.dropPosition == 'above'} {#if $dragDropStore && $dragDropStore.targetComponent === component && $dragDropStore.dropPosition === 'above'}
<div <div
on:drop={drop} on:drop={drop}
ondragover="return false" ondragover="return false"
@ -144,22 +144,13 @@
level={level + 1} /> level={level + 1} />
{/if} {/if}
{#if $dragDropStore && $dragDropStore.targetComponent === component && $dragDropStore.dropPosition == 'inside'} {#if $dragDropStore && $dragDropStore.targetComponent === component && ($dragDropStore.dropPosition === 'inside' || $dragDropStore.dropPosition === 'below')}
<div <div
on:drop={drop} on:drop={drop}
ondragover="return false" ondragover="return false"
ondragenter="return false" ondragenter="return false"
class="budibase__nav-item item drop-item" class="budibase__nav-item item drop-item"
style="margin-left: {(level + 2) * 20 + 40}px" /> style="margin-left: {(level + ($dragDropStore.dropPosition === 'inside' ? 2 : 0)) * 20 + 40}px" />
{/if}
{#if $dragDropStore && $dragDropStore.targetComponent === component && $dragDropStore.dropPosition == 'below'}
<div
on:drop={drop}
ondragover="return false"
ondragenter="return false"
class="budibase__nav-item item drop-item"
style="margin-left: {level * 20 + 40}px" />
{/if} {/if}
</li> </li>
{/each} {/each}