(
from: DescendentPaths | DescendentPaths[],
to: DescendentPaths | DescendentPaths[],
divideShape: UniversalTransitionOption['divideShape'],
seriesModel: SeriesModel,
dataIndex: number,
animateOtherProps: (
fromIndividual: Path,
toIndividual: Path,
rawFrom: Path,
rawTo: Path,
animationCfg: ElementAnimateConfig
) => void
)
| 108 | }; |
| 109 | |
| 110 | export function applyMorphAnimation( |
| 111 | from: DescendentPaths | DescendentPaths[], |
| 112 | to: DescendentPaths | DescendentPaths[], |
| 113 | divideShape: UniversalTransitionOption['divideShape'], |
| 114 | seriesModel: SeriesModel, |
| 115 | dataIndex: number, |
| 116 | animateOtherProps: ( |
| 117 | fromIndividual: Path, |
| 118 | toIndividual: Path, |
| 119 | rawFrom: Path, |
| 120 | rawTo: Path, |
| 121 | animationCfg: ElementAnimateConfig |
| 122 | ) => void |
| 123 | ) { |
| 124 | if (!from.length || !to.length) { |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | const updateAnimationCfg = getAnimationConfig('update', seriesModel, dataIndex); |
| 129 | if (!(updateAnimationCfg && updateAnimationCfg.duration > 0)) { |
| 130 | return; |
| 131 | } |
| 132 | const animationDelay = (seriesModel.getModel('universalTransition') as Model<UniversalTransitionOption>) |
| 133 | .get('delay'); |
| 134 | |
| 135 | |
| 136 | const animationCfg = extend({ |
| 137 | // Need to setToFinal so the further calculation based on the style can be correct. |
| 138 | // Like emphasis color. |
| 139 | setToFinal: true |
| 140 | } as SeparateConfig, updateAnimationCfg); |
| 141 | |
| 142 | |
| 143 | let many: DescendentPaths[]; |
| 144 | let one: DescendentPaths; |
| 145 | if (isMultiple(from)) { // manyToOne |
| 146 | many = from; |
| 147 | one = to as DescendentPaths; |
| 148 | } |
| 149 | if (isMultiple(to)) { // oneToMany |
| 150 | many = to; |
| 151 | one = from as DescendentPaths; |
| 152 | } |
| 153 | |
| 154 | function morphOneBatch( |
| 155 | batch: MorphingBatch, |
| 156 | fromIsMany: boolean, |
| 157 | animateIndex: number, |
| 158 | animateCount: number, |
| 159 | forceManyOne?: boolean |
| 160 | ) { |
| 161 | const batchMany = batch.many; |
| 162 | const batchOne = batch.one; |
| 163 | if (batchMany.length === 1 && !forceManyOne) { |
| 164 | // Is one to one |
| 165 | const batchFrom: Path = fromIsMany ? batchMany[0] : batchOne; |
| 166 | const batchTo: Path = fromIsMany ? batchOne : batchMany[0]; |
| 167 |
no test coverage detected
searching dependent graphs…