1
0
Fork 0
mirror of synced 2024-06-26 18:10:51 +12:00

Fix issues dropping components from new component panel

This commit is contained in:
Andrew Kingston 2022-10-14 18:24:47 +01:00
parent 121eddaa5a
commit 78a5f9c891
2 changed files with 5 additions and 9 deletions

View file

@ -245,6 +245,7 @@
drop.parent,
drop.index
)
return
}
// Convert parent + index into target + mode

View file

@ -2,10 +2,6 @@ import { writable, derived } from "svelte/store"
const createDndStore = () => {
const initialState = {
// Flags for whether we are inserting a new component or not
isNewComponent: false,
newComponentType: null,
// Info about the dragged component
source: null,
@ -24,8 +20,8 @@ const createDndStore = () => {
})
}
const startDraggingNewComponent = ({ type, definition }) => {
if (!type || !definition) {
const startDraggingNewComponent = ({ component, definition }) => {
if (!component || !definition) {
return
}
@ -35,13 +31,12 @@ const createDndStore = () => {
store.set({
...initialState,
isNewComponent: true,
newComponentType: type,
source: {
id: null,
parent: null,
bounds: { height, width },
index: null,
newComponentType: component,
},
})
}
@ -91,5 +86,5 @@ export const dndBounds = derived(
)
export const dndIsNewComponent = derived(
dndStore,
$dndStore => $dndStore.isNewComponent
$dndStore => $dndStore.source?.newComponentType != null
)