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

Function applyUpdateTransition

src/animation/customGraphicTransition.ts:129–208  ·  view source on GitHub ↗
(
    el: Element,
    elOption: TransitionElementOption,
    animatableModel?: Model<AnimationOptionMixin>,
    opts?: {
        dataIndex?: number,
        isInit?: boolean,
        clearStyle?: boolean
    }
)

Source from the content-addressed store, hash-verified

127
128
129export function applyUpdateTransition(
130 el: Element,
131 elOption: TransitionElementOption,
132 animatableModel?: Model<AnimationOptionMixin>,
133 opts?: {
134 dataIndex?: number,
135 isInit?: boolean,
136 clearStyle?: boolean
137 }
138) {
139 opts = opts || {};
140 const {dataIndex, isInit, clearStyle} = opts;
141
142 const hasAnimation = animatableModel.isAnimationEnabled();
143 // Save the meta info for further morphing. Like apply on the sub morphing elements.
144 const store = transitionInnerStore(el);
145 const styleOpt = elOption.style;
146 store.userDuring = elOption.during;
147
148 const transFromProps = {} as ElementProps;
149 const propsToSet = {} as ElementProps;
150
151 prepareTransformAllPropsFinal(el, elOption, propsToSet);
152
153 if (el.type === 'compound') {
154 /**
155 * We cannot directly clone shape for compoundPath,
156 * because it makes the path to be an object instead of a Path instance,
157 * and thus missing `buildPath` method.
158 */
159 const paths: Path[] = (el as Path).shape.paths;
160 const optionPaths = elOption.shape.paths as TransitionElementOption['shape']['paths'];
161 for (let i = 0; i < optionPaths.length; i++) {
162 const path = optionPaths[i];
163 prepareShapeOrExtraAllPropsFinal('shape', path, paths[i]);
164 }
165 }
166 else {
167 prepareShapeOrExtraAllPropsFinal('shape', elOption, propsToSet);
168 prepareShapeOrExtraAllPropsFinal('extra', elOption, propsToSet);
169 }
170
171 if (!isInit && hasAnimation) {
172 prepareTransformTransitionFrom(el, elOption, transFromProps);
173 prepareShapeOrExtraTransitionFrom('shape', el, elOption, transFromProps);
174 prepareShapeOrExtraTransitionFrom('extra', el, elOption, transFromProps);
175 prepareStyleTransitionFrom(el, elOption, styleOpt, transFromProps);
176 }
177
178 (propsToSet as DisplayableProps).style = styleOpt;
179
180 applyPropsDirectly(el, propsToSet, clearStyle);
181 applyMiscProps(el, elOption);
182
183 if (hasAnimation) {
184 if (isInit) {
185 const enterFromProps: ElementProps = {};
186 each(ELEMENT_ANIMATABLE_PROPS, propName => {

Callers 2

updateElNormalFunction · 0.90
_updateElementsMethod · 0.90

Calls 14

applyPropsDirectlyFunction · 0.85
applyMiscPropsFunction · 0.85
extendFunction · 0.85
applyPropsTransitionFunction · 0.85
updateLeaveToFunction · 0.85
eachFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…