| 7 | |
| 8 | return { |
| 9 | captureAnimationState() { |
| 10 | animationStates = []; |
| 11 | if (!this.options.animation) return; |
| 12 | let children = [].slice.call(this.el.children); |
| 13 | |
| 14 | children.forEach(child => { |
| 15 | if (css(child, 'display') === 'none' || child === Sortable.ghost) return; |
| 16 | animationStates.push({ |
| 17 | target: child, |
| 18 | rect: getRect(child) |
| 19 | }); |
| 20 | let fromRect = { ...animationStates[animationStates.length - 1].rect }; |
| 21 | |
| 22 | // If animating: compensate for current animation |
| 23 | if (child.thisAnimationDuration) { |
| 24 | let childMatrix = matrix(child, true); |
| 25 | if (childMatrix) { |
| 26 | fromRect.top -= childMatrix.f; |
| 27 | fromRect.left -= childMatrix.e; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | child.fromRect = fromRect; |
| 32 | }); |
| 33 | }, |
| 34 | |
| 35 | addAnimationState(state) { |
| 36 | animationStates.push(state); |