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:
parent
8cf3971b47
commit
e19d17c4f5
|
@ -174,7 +174,7 @@
|
||||||
|
|
||||||
// Drag and drop helper tags
|
// Drag and drop helper tags
|
||||||
$: draggable = interactive && !isLayout && !isScreen
|
$: draggable = interactive && !isLayout && !isScreen
|
||||||
$: droppable = interactive
|
$: droppable = interactive && !isLayout && !isScreen
|
||||||
$: dropInside = interactive && definition?.hasChildren && !children.length
|
$: dropInside = interactive && definition?.hasChildren && !children.length
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -105,9 +105,14 @@
|
||||||
const element = e.target.closest("[data-type='component']")
|
const element = e.target.closest("[data-type='component']")
|
||||||
if (
|
if (
|
||||||
element &&
|
element &&
|
||||||
element.dataset.droppable &&
|
element.dataset.droppable === "true" &&
|
||||||
element.dataset.id !== dragInfo.target
|
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.
|
// Ensure the dragging flag is always set.
|
||||||
// There's a bit of a race condition between the app reinitialisation
|
// There's a bit of a race condition between the app reinitialisation
|
||||||
// after selecting the DND component and setting this the first time
|
// after selecting the DND component and setting this the first time
|
||||||
|
|
Loading…
Reference in New Issue