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

Function updateElNormal

src/chart/custom/CustomView.ts:477–544  ·  view source on GitHub ↗
(
    // Can be null/undefined
    api: ExtensionAPI,
    el: Element,
    dataIndex: number,
    elOption: CustomElementOption,
    attachedTxInfo: AttachedTxInfo,
    seriesModel: CustomSeriesModel,
    isInit: boolean
)

Source from the content-addressed store, hash-verified

475}
476
477function updateElNormal(
478 // Can be null/undefined
479 api: ExtensionAPI,
480 el: Element,
481 dataIndex: number,
482 elOption: CustomElementOption,
483 attachedTxInfo: AttachedTxInfo,
484 seriesModel: CustomSeriesModel,
485 isInit: boolean
486): void {
487
488 // Stop and restore before update any other attributes.
489 stopPreviousKeyframeAnimationAndRestore(el);
490
491 const txCfgOpt = attachedTxInfo && attachedTxInfo.normal.cfg;
492 if (txCfgOpt) {
493 // PENDING: whether use user object directly rather than clone?
494 // TODO:5.0 textConfig transition animation?
495 el.setTextConfig(txCfgOpt);
496 }
497
498 // Default transition ['x', 'y']
499 if (elOption && elOption.transition == null) {
500 elOption.transition = DEFAULT_TRANSITION;
501 }
502
503 // Do some normalization on style.
504 const styleOpt = elOption && (elOption as CustomDisplayableOption).style;
505
506 if (styleOpt) {
507 if (el.type === 'text') {
508 const textOptionStyle = styleOpt as TextStyleProps;
509 // Compatible with ec4: if `textFill` or `textStroke` exists use them.
510 hasOwn(textOptionStyle, 'textFill') && (
511 textOptionStyle.fill = (textOptionStyle as any).textFill
512 );
513 hasOwn(textOptionStyle, 'textStroke') && (
514 textOptionStyle.stroke = (textOptionStyle as any).textStroke
515 );
516 }
517
518 let decalPattern;
519 const decalObj = isPath(el) ? (styleOpt as CustomBaseZRPathOption['style']).decal : null;
520 if (api && decalObj) {
521 (decalObj as InnerDecalObject).dirty = true;
522 decalPattern = createOrUpdatePatternFromDecal(decalObj, api);
523 }
524 // Always overwrite in case user specify this prop.
525 (styleOpt as InnerCustomZRPathOptionStyle).__decalPattern = decalPattern;
526 }
527
528 if (isDisplayable(el)) {
529 if (styleOpt) {
530 const decalPattern = (styleOpt as InnerCustomZRPathOptionStyle).__decalPattern;
531 if (decalPattern) {
532 (styleOpt as PathStyleProps).decal = decalPattern;
533 }
534 }

Callers 3

doCreateOrUpdateElFunction · 0.85
doCreateOrUpdateClipPathFunction · 0.85

Calls 7

applyUpdateTransitionFunction · 0.90
applyKeyframeAnimationFunction · 0.90
isDisplayableFunction · 0.85
isPathFunction · 0.70
hasOwnFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…