MCPcopy Index your code
hub / github.com/SortableJS/Sortable / dragOverCompleted

Function dragOverCompleted

plugins/MultiDrag/MultiDrag.js:227–281  ·  view source on GitHub ↗
({ sortable, isOwner, insertion, activeSortable, parentEl, putSortable })

Source from the content-addressed store, hash-verified

225 },
226
227 dragOverCompleted({ sortable, isOwner, insertion, activeSortable, parentEl, putSortable }) {
228 let options = this.options;
229 if (insertion) {
230 // Clones must be hidden before folding animation to capture dragRectAbsolute properly
231 if (isOwner) {
232 activeSortable._hideClone();
233 }
234
235 initialFolding = false;
236 // If leaving sort:false root, or already folding - Fold to new location
237 if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {
238 // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible
239 let dragRectAbsolute = getRect(dragEl, false, true, true);
240
241 multiDragElements.forEach(multiDragElement => {
242 if (multiDragElement === dragEl) return;
243 setRect(multiDragElement, dragRectAbsolute);
244
245 // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted
246 // while folding, and so that we can capture them again because old sortable will no longer be fromSortable
247 parentEl.appendChild(multiDragElement);
248 });
249
250 folding = true;
251 }
252
253 // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out
254 if (!isOwner) {
255 // Only remove if not folding (folding will remove them anyways)
256 if (!folding) {
257 removeMultiDragElements();
258 }
259
260 if (multiDragElements.length > 1) {
261 let clonesHiddenBefore = clonesHidden;
262 activeSortable._showClone(sortable);
263
264 // Unfold animation for clones if showing from hidden
265 if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {
266 multiDragClones.forEach(clone => {
267 activeSortable.addAnimationState({
268 target: clone,
269 rect: clonesFromRect
270 });
271
272 clone.fromRect = clonesFromRect;
273 clone.thisAnimationDuration = null;
274 });
275 }
276 } else {
277 activeSortable._showClone(sortable);
278 }
279 }
280 }
281 },
282
283 dragOverAnimationCapture({ dragRect, isOwner, activeSortable }) {
284 multiDragElements.forEach(multiDragElement => {

Callers

nothing calls this directly

Calls 3

getRectFunction · 0.90
setRectFunction · 0.90
removeMultiDragElementsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…