提交 9919c522 编写于 作者: P pissang

fix(state): use flag to determine which states to restore instead of simply save and restore

上级 a2645c1b
......@@ -1826,21 +1826,14 @@ class ECharts extends Eventful {
});
};
interface DisplayableWithStatesHistory extends Displayable {
__prevStates: string[]
};
// Clear states without animation.
// TODO States on component.
function clearStates(model: ComponentModel, view: ComponentView | ChartView): void {
view.group.traverse(function (el: Displayable) {
// TODO If el is incremental.
if (el.hasState()) {
(el as DisplayableWithStatesHistory).__prevStates = el.currentStates;
el.clearStates();
}
else if ((el as DisplayableWithStatesHistory).__prevStates) {
(el as DisplayableWithStatesHistory).__prevStates = null;
}
const textContent = el.getTextContent();
const textGuide = el.getTextGuideLine();
......@@ -1862,11 +1855,6 @@ class ECharts extends Eventful {
view.group.traverse(function (el: Displayable) {
// Only updated on changed element. In case element is incremental and don't wan't to rerender.
if (el.__dirty && el.states && el.states.emphasis) {
const prevStates = (el as DisplayableWithStatesHistory).__prevStates;
// Restore states without animation
if (prevStates) {
el.useStates(prevStates);
}
// Update state transition and enable animation again.
if (enableAnimation) {
graphic.setStateTransition(el, stateAnimationModel);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册