svelte-dnd-action
Advanced tools
Comparing version 0.9.13 to 0.9.14
@@ -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.13", | ||
"version": "0.9.14", | ||
"repository": { | ||
@@ -46,0 +46,0 @@ "type": "git", |
@@ -16,2 +16,11 @@ import {isCenterOfAInsideB, calcDistanceBetweenCenters, getAbsoluteRectNoTransforms, isPointInsideRect, findCenterOfElement} from "./intersection"; | ||
/** | ||
* Resets the cache that allows for smarter "would be index" resolution for a specific dropzone, should be called after the zone was scrolled | ||
* @param {HTMLElement} dz | ||
*/ | ||
export function resetIndexesCacheForDz(dz) { | ||
printDebug(() => "resetting indexes cache for dz"); | ||
dzToShadowIndexToRect.delete(dz); | ||
} | ||
/** | ||
* Caches the coordinates of the shadow element when it's in a certain index in a certain dropzone. | ||
@@ -18,0 +27,0 @@ * Helpful in order to determine "would be index" more effectively |
@@ -1,2 +0,2 @@ | ||
import {findWouldBeIndex, resetIndexesCache} from "./listUtil"; | ||
import {findWouldBeIndex, resetIndexesCache, resetIndexesCacheForDz} from "./listUtil"; | ||
import {findCenterOfElement, isElementOffDocument} from "./intersection"; | ||
@@ -60,2 +60,3 @@ import { | ||
for (const dz of dropZonesFromDeepToShallow) { | ||
if (scrolled) resetIndexesCacheForDz(lastDropZoneFound); | ||
const indexObj = findWouldBeIndex(draggedEl, dz); | ||
@@ -62,0 +63,0 @@ if (indexObj === null) { |
import {makeScroller} from "./scroller"; | ||
import {printDebug} from "../constants"; | ||
import {resetIndexesCache} from "./listUtil"; | ||
@@ -21,3 +22,4 @@ const INTERVAL_MS = 300; | ||
if (mousePosition) { | ||
scrollIfNeeded(mousePosition, document.documentElement); | ||
const scrolled = scrollIfNeeded(mousePosition, document.documentElement); | ||
if (scrolled) resetIndexesCache(); | ||
} | ||
@@ -24,0 +26,0 @@ next = window.setTimeout(loop, INTERVAL_MS); |
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
273121
6339