svelte-dnd-action
Advanced tools
Comparing version 0.9.17 to 0.9.18
@@ -43,3 +43,3 @@ { | ||
"description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *", | ||
"version": "0.9.17", | ||
"version": "0.9.18", | ||
"repository": { | ||
@@ -46,0 +46,0 @@ "type": "git", |
@@ -139,3 +139,3 @@ import {SHADOW_ELEMENT_ATTRIBUTE_NAME, DRAGGED_ELEMENT_ID} from "../constants"; | ||
*/ | ||
export function hideOriginalDragTarget(dragTarget) { | ||
export function hideElement(dragTarget) { | ||
dragTarget.style.display = "none"; | ||
@@ -142,0 +142,0 @@ dragTarget.style.position = "fixed"; |
@@ -16,3 +16,3 @@ import { | ||
decorateShadowEl, | ||
hideOriginalDragTarget, | ||
hideElement, | ||
morphDraggedElementToBeLike, | ||
@@ -59,2 +59,3 @@ moveDraggedElementToWasDroppedState, | ||
let isDraggedOutsideOfAnyDz = false; | ||
let scheduledForRemovalAfterDrop = []; | ||
@@ -285,2 +286,9 @@ // a map from type to a set of drop-zones | ||
function scheduleDZForRemovalAfterDrop(dz, destroy) { | ||
scheduledForRemovalAfterDrop.push({dz, destroy}); | ||
window.requestAnimationFrame(() => { | ||
hideElement(dz); | ||
document.body.appendChild(dz); | ||
}); | ||
} | ||
/* cleanup */ | ||
@@ -290,2 +298,10 @@ function cleanupPostDrop() { | ||
originalDragTarget.remove(); | ||
if (scheduledForRemovalAfterDrop.length) { | ||
printDebug(() => ["will destroy zones that were removed during drag", scheduledForRemovalAfterDrop]); | ||
scheduledForRemovalAfterDrop.forEach(({dz, destroy}) => { | ||
destroy(); | ||
dz.remove(); | ||
}) | ||
scheduledForRemovalAfterDrop = []; | ||
} | ||
draggedEl = undefined; | ||
@@ -405,3 +421,3 @@ originalDragTarget = undefined; | ||
watchDraggedElement(); | ||
hideOriginalDragTarget(originalDragTarget); | ||
hideElement(originalDragTarget); | ||
originDropZoneRoot.appendChild(originalDragTarget); | ||
@@ -537,7 +553,15 @@ } else { | ||
destroy: () => { | ||
printDebug(() => "pointer dndzone will destroy"); | ||
unregisterDropZone(node, config.type); | ||
dzToConfig.delete(node); | ||
function destroyDz() { | ||
printDebug(() => "pointer dndzone will destroy"); | ||
unregisterDropZone(node, dzToConfig.get(node).type); | ||
dzToConfig.delete(node); | ||
} | ||
if (isWorkingOnPreviousDrag) { | ||
printDebug(() => "pointer dndzone will be scheduled for destruction"); | ||
scheduleDZForRemovalAfterDrop(node, destroyDz); | ||
} else { | ||
destroyDz(); | ||
} | ||
} | ||
}; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
282097
6618