From 658d01a903922f18f403bcc951f7150690877759 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Fri, 6 Mar 2020 16:34:11 +0800 Subject: [PATCH 1/3] fix(pie): label not show when animation is disabled. fix #12110 --- src/chart/pie/PieView.js | 31 ++++++++++++++----------- test/pie-animation.html | 49 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 15 deletions(-) diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js index dc9f635f3c..78cc7222b0 100644 --- a/src/chart/pie/PieView.js +++ b/src/chart/pie/PieView.js @@ -180,31 +180,36 @@ piePieceProto.updateData = function (data, idx, firstCreate) { var withAnimation = !firstCreate && animationTypeUpdate === 'transition'; this._updateLabel(data, idx, withAnimation); - this.highDownOnUpdate = (itemModel.get('hoverAnimation') && seriesModel.isAnimationEnabled()) + this.highDownOnUpdate = !seriesModel.get('silent') ? function (fromState, toState) { + const hasAnimation = seriesModel.isAnimationEnabled(); if (toState === 'emphasis') { labelLine.ignore = labelLine.hoverIgnore; labelText.ignore = labelText.hoverIgnore; // Sector may has animation of updating data. Force to move to the last frame // Or it may stopped on the wrong shape - sector.stopAnimation(true); - sector.animateTo({ - shape: { - r: layout.r + seriesModel.get('hoverOffset') - } - }, 300, 'elasticOut'); + if (hasAnimation) { + sector.stopAnimation(true); + sector.animateTo({ + shape: { + r: layout.r + seriesModel.get('hoverOffset') + } + }, 300, 'elasticOut'); + } } else { labelLine.ignore = labelLine.normalIgnore; labelText.ignore = labelText.normalIgnore; - sector.stopAnimation(true); - sector.animateTo({ - shape: { - r: layout.r - } - }, 300, 'elasticOut'); + if (hasAnimation) { + sector.stopAnimation(true); + sector.animateTo({ + shape: { + r: layout.r + } + }, 300, 'elasticOut'); + } } } : null; diff --git a/test/pie-animation.html b/test/pie-animation.html index 679b50bbb8..fe72d664c1 100644 --- a/test/pie-animation.html +++ b/test/pie-animation.html @@ -31,7 +31,8 @@ html, body, #main1, - #main2 { + #main2, + #main3 { width: 100%; height: 250px; margin: 0; @@ -57,7 +58,10 @@
- From da366f9edfbf6f3c00bd0b52273431bd1eec24e1 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Fri, 6 Mar 2020 16:38:13 +0800 Subject: [PATCH 2/3] test(pie): update test case --- test/pie-animation.html | 4 ++-- test/runTest/actions/__meta__.json | 1 + test/runTest/actions/pie-animation.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 test/runTest/actions/pie-animation.json diff --git a/test/pie-animation.html b/test/pie-animation.html index fe72d664c1..5c0cec6d8f 100644 --- a/test/pie-animation.html +++ b/test/pie-animation.html @@ -61,7 +61,7 @@
Should display labels on emphasis if no animation
- + diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index 16695409ad..35846a21be 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -109,6 +109,7 @@ "pie": 1, "pie-action": 1, "pie-alignTo": 4, + "pie-animation": 1, "pie-calculable": 1, "polar-rounded": 3, "polarLine": 1, diff --git a/test/runTest/actions/pie-animation.json b/test/runTest/actions/pie-animation.json new file mode 100644 index 0000000000..b788d989bc --- /dev/null +++ b/test/runTest/actions/pie-animation.json @@ -0,0 +1 @@ +[{"name":"Action 1","ops":[{"type":"mousemove","time":2246,"x":225,"y":453},{"type":"mousemove","time":2453,"x":225,"y":453},{"type":"mousemove","time":2845,"x":225,"y":453},{"type":"mousemove","time":3045,"x":268,"y":465},{"type":"mousemove","time":3245,"x":312,"y":468},{"type":"mousemove","time":3449,"x":328,"y":469},{"type":"mousemove","time":3669,"x":328,"y":469},{"type":"screenshot","time":4152}],"scrollY":390,"scrollX":0,"timestamp":1583724042816}] \ No newline at end of file From 9e4d854d2a2271bb98b9814ff00735586f6f6178 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Fri, 10 Apr 2020 13:38:38 +0800 Subject: [PATCH 3/3] fix(pie): dont use animation if no hoverAnimation --- src/chart/pie/PieView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/pie/PieView.js b/src/chart/pie/PieView.js index 78cc7222b0..2d9d609703 100644 --- a/src/chart/pie/PieView.js +++ b/src/chart/pie/PieView.js @@ -182,7 +182,7 @@ piePieceProto.updateData = function (data, idx, firstCreate) { this.highDownOnUpdate = !seriesModel.get('silent') ? function (fromState, toState) { - const hasAnimation = seriesModel.isAnimationEnabled(); + const hasAnimation = seriesModel.isAnimationEnabled() && itemModel.get('hoverAnimation'); if (toState === 'emphasis') { labelLine.ignore = labelLine.hoverIgnore; labelText.ignore = labelText.hoverIgnore;