MCPcopy
hub / github.com/apache/echarts / updateOneToOne

Function updateOneToOne

src/animation/universalTransition.ts:335–386  ·  view source on GitHub ↗
(newIndex: number, oldIndex: number)

Source from the content-addressed store, hash-verified

333 }
334
335 function updateOneToOne(newIndex: number, oldIndex: number) {
336
337 const oldItem = oldDiffItems[oldIndex];
338 const newItem = newDiffItems[newIndex];
339
340 const newSeries = newItem.data.hostModel as SeriesModel;
341
342 // TODO Mark this elements is morphed and don't morph them anymore
343 const oldEl = oldItem.data.getItemGraphicEl(oldItem.dataIndex);
344 const newEl = newItem.data.getItemGraphicEl(newItem.dataIndex);
345
346 // Can't handle same elements.
347 if (oldEl === newEl) {
348 newEl && animateElementStyles(newEl, newItem.dataIndex, newSeries);
349 return;
350 }
351
352 if (
353 // We can't use the elements that already being morphed
354 (oldEl && isElementStillInChart[oldEl.id])
355 ) {
356 return;
357 }
358
359 if (newEl) {
360 // TODO: If keep animating the group in case
361 // some of the elements don't want to be morphed.
362 // TODO Label?
363 stopAnimation(newEl);
364
365 if (oldEl) {
366 stopAnimation(oldEl);
367
368 // If old element is doing leaving animation. stop it and remove it immediately.
369 removeEl(oldEl);
370
371 hasMorphAnimation = true;
372 applyMorphAnimation(
373 getPathList(oldEl),
374 getPathList(newEl),
375 newItem.divide,
376 newSeries,
377 newIndex,
378 updateMorphingPathProps
379 );
380 }
381 else {
382 fadeInElement(newEl, newSeries, newIndex);
383 }
384 }
385 // else keep oldEl leaving animation.
386 }
387
388 (new DataDiffer(
389 oldDiffItems,

Callers 1

transitionBetweenFunction · 0.85

Calls 7

applyMorphAnimationFunction · 0.90
getPathListFunction · 0.90
animateElementStylesFunction · 0.85
stopAnimationFunction · 0.85
fadeInElementFunction · 0.85
getItemGraphicElMethod · 0.80
removeElFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…