1
0
Fork 0
mirror of synced 2024-07-02 21:10:43 +12:00

Prevent DND targetting either above or below the screen/layout, and fix bug determinging whether a drop target is valid

This commit is contained in:
Andrew Kingston 2021-09-20 09:12:35 +01:00
parent c2aeefae7b
commit 03be8ee153
2 changed files with 7 additions and 2 deletions

View file

@ -174,7 +174,7 @@
// Drag and drop helper tags
$: draggable = interactive && !isLayout && !isScreen
$: droppable = interactive
$: droppable = interactive && !isLayout && !isScreen
$: dropInside = interactive && definition?.hasChildren && !children.length
</script>

View file

@ -105,9 +105,14 @@
const element = e.target.closest("[data-type='component']")
if (
element &&
element.dataset.droppable &&
element.dataset.droppable === "true" &&
element.dataset.id !== dragInfo.target
) {
// Do nothing if this is the same target
if (element.dataset.id === dropInfo?.target) {
return
}
// Ensure the dragging flag is always set.
// There's a bit of a race condition between the app reinitialisation
// after selecting the DND component and setting this the first time