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

Function animateAll

src/Animation.js:43–130  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

41 },
42
43 animateAll(callback) {
44 if (!this.options.animation) {
45 clearTimeout(animationCallbackId);
46 if (typeof(callback) === 'function') callback();
47 return;
48 }
49
50 let animating = false,
51 animationTime = 0;
52
53 animationStates.forEach((state) => {
54 let time = 0,
55 animatingThis = false,
56 target = state.target,
57 fromRect = target.fromRect,
58 toRect = getRect(target),
59 prevFromRect = target.prevFromRect,
60 prevToRect = target.prevToRect,
61 animatingRect = state.rect,
62 targetMatrix = matrix(target, true);
63
64
65 if (targetMatrix) {
66 // Compensate for current animation
67 toRect.top -= targetMatrix.f;
68 toRect.left -= targetMatrix.e;
69 }
70
71 target.toRect = toRect;
72
73 if (target.thisAnimationDuration) {
74 // Could also check if animatingRect is between fromRect and toRect
75 if (
76 isRectEqual(prevFromRect, toRect) &&
77 !isRectEqual(fromRect, toRect) &&
78 // Make sure animatingRect is on line between toRect & fromRect
79 (animatingRect.top - toRect.top) /
80 (animatingRect.left - toRect.left) ===
81 (fromRect.top - toRect.top) /
82 (fromRect.left - toRect.left)
83 ) {
84 // If returning to same place as started from animation and on same axis
85 time = calculateRealTime(animatingRect, prevFromRect, prevToRect, this.options);
86 }
87 }
88
89 // if fromRect != toRect: animate
90 if (!isRectEqual(toRect, fromRect)) {
91 target.prevFromRect = fromRect;
92 target.prevToRect = toRect;
93
94 if (!time) {
95 time = this.options.animation;
96 }
97 this.animate(
98 target,
99 animatingRect,
100 toRect,

Callers

nothing calls this directly

Calls 4

getRectFunction · 0.90
matrixFunction · 0.90
isRectEqualFunction · 0.90
calculateRealTimeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…