Skip to content

Commit 3ea8fbe

Browse files
authored
Fix quickly drag elements between nested blocks (#2573)
* fix #2560
1 parent dcf5316 commit 3ea8fbe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/dd-droppable.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt
9494

9595
// make sure when we enter this, that the last one gets a leave FIRST to correctly cleanup as we don't always do
9696
if (DDManager.dropElement && DDManager.dropElement !== this) {
97-
DDManager.dropElement._mouseLeave(e as DragEvent);
97+
DDManager.dropElement._mouseLeave(e as DragEvent, true);
9898
}
9999
DDManager.dropElement = this;
100100

@@ -108,7 +108,7 @@ export class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt
108108
}
109109

110110
/** @internal called when the item is leaving our area, stop tracking if we had moving item */
111-
protected _mouseLeave(e: MouseEvent): void {
111+
protected _mouseLeave(e: MouseEvent, external = false): void {
112112
// console.log(`${count++} Leave ${this.el.id || (this.el as GridHTMLElement).gridstack.opts.id}`); // TEST
113113
if (!DDManager.dragElement || DDManager.dropElement !== this) return;
114114
e.preventDefault();
@@ -120,7 +120,7 @@ export class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt
120120
}
121121
this.triggerEvent('dropout', ev);
122122

123-
if (DDManager.dropElement === this) {
123+
if (!external && DDManager.dropElement === this) {
124124
delete DDManager.dropElement;
125125
// console.log('not tracking'); // TEST
126126

0 commit comments

Comments
 (0)