This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch fix/treemap-click in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit f62945c67ed8abf2a3818ed8e5f03d431739c2ea Author: 100pah <[email protected]> AuthorDate: Mon Nov 2 01:24:40 2020 +0800 fix: fix done/aborted in treemap. The bug case is: when click treemap to "drill down", and hover another rect to start state-changeing-animation before the drill down animation finished, some of the done/abort callback may not be called and then all of the "click" disabled (by the implementation of `src/util/animation.ts`. --- src/chart/treemap/TreemapView.ts | 2 +- src/util/animation.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/chart/treemap/TreemapView.ts b/src/chart/treemap/TreemapView.ts index 42ba1e1..9a3b4d5 100644 --- a/src/chart/treemap/TreemapView.ts +++ b/src/chart/treemap/TreemapView.ts @@ -462,7 +462,7 @@ class TreemapView extends ChartView { this._state = 'animating'; animationWrap - .done(bind(function () { + .finished(bind(function () { this._state = 'ready'; renderResult.renderFinally(); }, this)) diff --git a/src/util/animation.ts b/src/util/animation.ts index d48b527..246d9f0 100644 --- a/src/util/animation.ts +++ b/src/util/animation.ts @@ -46,7 +46,7 @@ class AnimationWrap { private _storage = [] as AnimationWrapStorage[]; private _elExistsMap: { [elId: string]: boolean } = {}; - private _doneCallback: AnimationWrapDoneCallback; + private _finishedCallback: AnimationWrapDoneCallback; /** * Caution: a el can only be added once, otherwise 'done' @@ -79,11 +79,10 @@ class AnimationWrap { } /** - * Only execute when animation finished. Will not execute when any - * of 'stop' or 'stopAnimation' called. + * Only execute when animation done/aborted. */ - done(callback: AnimationWrapDoneCallback): AnimationWrap { - this._doneCallback = callback; + finished(callback: AnimationWrapDoneCallback): AnimationWrap { + this._finishedCallback = callback; return this; } @@ -93,12 +92,12 @@ class AnimationWrap { start(): AnimationWrap { let count = this._storage.length; - const done = () => { + const checkTerminate = () => { count--; - if (!count) { + if (count <= 0) { // Guard. this._storage.length = 0; this._elExistsMap = {}; - this._doneCallback && this._doneCallback(); + this._finishedCallback && this._finishedCallback(); } }; @@ -109,7 +108,8 @@ class AnimationWrap { delay: item.delay, easing: item.easing, setToFinal: true, - done + done: checkTerminate, + aborted: checkTerminate }); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
