svelte-dnd-action
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -555,2 +555,3 @@ (function (global, factory) { | ||
const ITEM_ID_KEY = "id"; | ||
const DEFAULT_DROP_ZONE_TYPE = '--any--'; | ||
@@ -611,3 +612,3 @@ const MIN_OBSERVATION_INTERVAL_MS = 100; | ||
const observationIntervalMs = Math.max(MIN_OBSERVATION_INTERVAL_MS, ...Array.from(dropZones.keys()).map(dz => dzToConfig.get(dz).dropAnimationDurationMs)); | ||
observe(draggedEl, dropZones, observationIntervalMs); | ||
observe(draggedEl, dropZones, observationIntervalMs * 1.07); | ||
} | ||
@@ -835,8 +836,14 @@ function unWatchDraggedElement() { | ||
// We will keep the original dom node in the dom because touch events keep firing on it, we want to re-add it after Svelte removes it | ||
window.setTimeout(() => { | ||
document.body.appendChild(draggedEl); | ||
watchDraggedElement(); | ||
hideOriginalDragTarget(originalDragTarget); | ||
document.body.appendChild(originalDragTarget); | ||
}, 20); | ||
function keepOriginalElementInDom() { | ||
const {items: itemsNow} = config; | ||
if (!draggedEl.parentElement && (!itemsNow[originIndex] || draggedElData[ITEM_ID_KEY] !== itemsNow[originIndex][ITEM_ID_KEY])) { | ||
document.body.appendChild(draggedEl); | ||
watchDraggedElement(); | ||
hideOriginalDragTarget(originalDragTarget); | ||
document.body.appendChild(originalDragTarget); | ||
} else { | ||
window.requestAnimationFrame(keepOriginalElementInDom); | ||
} | ||
} | ||
window.requestAnimationFrame(keepOriginalElementInDom); | ||
@@ -843,0 +850,0 @@ styleActiveDropZones( |
@@ -33,3 +33,3 @@ { | ||
"description": "*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.2.7", | ||
"version": "0.2.8", | ||
"dependencies": { | ||
@@ -36,0 +36,0 @@ "acorn": "^7.1.1", |
@@ -14,2 +14,3 @@ import { observe, unobserve } from './helpers/observer'; | ||
import { DRAGGED_ENTERED_EVENT_NAME, DRAGGED_LEFT_EVENT_NAME, DRAGGED_LEFT_DOCUMENT_EVENT_NAME, DRAGGED_OVER_INDEX_EVENT_NAME, dispatchConsiderEvent, dispatchFinalizeEvent } from './helpers/dispatcher'; | ||
const ITEM_ID_KEY = "id"; | ||
const DEFAULT_DROP_ZONE_TYPE = '--any--'; | ||
@@ -70,3 +71,3 @@ const MIN_OBSERVATION_INTERVAL_MS = 100; | ||
const observationIntervalMs = Math.max(MIN_OBSERVATION_INTERVAL_MS, ...Array.from(dropZones.keys()).map(dz => dzToConfig.get(dz).dropAnimationDurationMs)); | ||
observe(draggedEl, dropZones, observationIntervalMs); | ||
observe(draggedEl, dropZones, observationIntervalMs * 1.07); | ||
} | ||
@@ -294,8 +295,14 @@ function unWatchDraggedElement() { | ||
// We will keep the original dom node in the dom because touch events keep firing on it, we want to re-add it after Svelte removes it | ||
window.setTimeout(() => { | ||
document.body.appendChild(draggedEl); | ||
watchDraggedElement(); | ||
hideOriginalDragTarget(originalDragTarget); | ||
document.body.appendChild(originalDragTarget); | ||
}, 20); | ||
function keepOriginalElementInDom() { | ||
const {items: itemsNow} = config; | ||
if (!draggedEl.parentElement && (!itemsNow[originIndex] || draggedElData[ITEM_ID_KEY] !== itemsNow[originIndex][ITEM_ID_KEY])) { | ||
document.body.appendChild(draggedEl); | ||
watchDraggedElement(); | ||
hideOriginalDragTarget(originalDragTarget); | ||
document.body.appendChild(originalDragTarget); | ||
} else { | ||
window.requestAnimationFrame(keepOriginalElementInDom); | ||
} | ||
} | ||
window.requestAnimationFrame(keepOriginalElementInDom); | ||
@@ -302,0 +309,0 @@ styleActiveDropZones( |
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
125027
2609