You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/10/20 10:40:40 UTC
[incubator-echarts] 02/02: fix: optimize symbol animation
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit f543734d3f979812b4b8f00c73328c2ef5541742
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Oct 20 18:39:55 2020 +0800
fix: optimize symbol animation
---
src/chart/helper/Symbol.ts | 28 +++++++++++++---------------
src/chart/line/LineView.ts | 7 ++++---
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index 5217780..7acb533 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -177,20 +177,19 @@ class Symbol extends graphic.Group {
if (isInit) {
const symbolPath = this.childAt(0) as ECSymbol;
- const target: PathProps = {
- scaleX: this._sizeX,
- scaleY: this._sizeY,
- style: {
- // Always fadeIn. Because it has fadeOut animation when symbol is removed..
- opacity: symbolPath.style.opacity
- }
- };
-
- symbolPath.scaleX = symbolPath.scaleY = 0;
- symbolPath.style.opacity = 0;
-
- disableAnimation ? symbolPath.attr(target)
- : graphic.initProps(symbolPath, target, seriesModel, idx);
+ if (!disableAnimation) {
+ const target: PathProps = {
+ scaleX: this._sizeX,
+ scaleY: this._sizeY,
+ style: {
+ // Always fadeIn. Because it has fadeOut animation when symbol is removed..
+ opacity: symbolPath.style.opacity
+ }
+ };
+ symbolPath.scaleX = symbolPath.scaleY = 0;
+ symbolPath.style.opacity = 0;
+ graphic.initProps(symbolPath, target, seriesModel, idx);
+ }
}
this._seriesModel = seriesModel;
@@ -335,7 +334,6 @@ class Symbol extends graphic.Group {
emphasisState.scaleX = this._sizeX * scaleRatio;
emphasisState.scaleY = this._sizeY * scaleRatio;
}
-
this.setSymbolScale(1);
enableHoverEmphasis(this, focus, blurScope);
diff --git a/src/chart/line/LineView.ts b/src/chart/line/LineView.ts
index 4a8a48a..654783e 100644
--- a/src/chart/line/LineView.ts
+++ b/src/chart/line/LineView.ts
@@ -1008,7 +1008,10 @@ class LineView extends ChartView {
const delay = typeof seriesDalay === 'function' ? seriesDalay(idx)
: (seriesDuration * ratio) + seriesDalayValue;
- el.animateFrom({
+ const symbolPath = el.getSymbolPath();
+ const text = symbolPath.getTextContent();
+
+ symbolPath.animateFrom({
scaleX: 0,
scaleY: 0
}, {
@@ -1016,8 +1019,6 @@ class LineView extends ChartView {
delay: delay
});
- const symbolPath = el.getSymbolPath();
- const text = symbolPath.getTextContent();
if (text) {
text.animateFrom({
style: {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org