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/12 11:25:38 UTC

[incubator-echarts] branch next updated: fix(graph): fix symbol scale wrong on graph.

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


The following commit(s) were added to refs/heads/next by this push:
     new ed2a14b  fix(graph): fix symbol scale wrong on graph.
ed2a14b is described below

commit ed2a14b3317e13707b04e689376d9a73b4818a74
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Oct 12 19:25:14 2020 +0800

    fix(graph): fix symbol scale wrong on graph.
---
 src/chart/helper/Symbol.ts | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index 535a17e..5217780 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -324,34 +324,25 @@ class Symbol extends graphic.Group {
         this._sizeX = symbolSize[0] / 2;
         this._sizeY = symbolSize[1] / 2;
 
-        symbolPath.ensureState('emphasis').style = emphasisItemStyle;
+        const emphasisState = symbolPath.ensureState('emphasis');
+
+        emphasisState.style = emphasisItemStyle;
         symbolPath.ensureState('select').style = selectItemStyle;
         symbolPath.ensureState('blur').style = blurItemStyle;
 
         if (hoverScale) {
-            this.ensureState('emphasis');
-            this.setSymbolScale(1);
-        }
-        else {
-            this.states.emphasis = null;
+            const scaleRatio = Math.max(1.1, 3 / this._sizeY);
+            emphasisState.scaleX = this._sizeX * scaleRatio;
+            emphasisState.scaleY = this._sizeY * scaleRatio;
         }
 
+        this.setSymbolScale(1);
+
         enableHoverEmphasis(this, focus, blurScope);
     }
 
     setSymbolScale(scale: number) {
-        const sizeX = this._sizeX;
-        const sizeY = this._sizeY;
-        const symbolPath = this.childAt(0);
-        const emphasisState = symbolPath.states.emphasis;
-        if (emphasisState) {
-            const hoverScale = Math.max(scale * 1.1, 3 / sizeY + scale);
-            emphasisState.scaleX = sizeX * hoverScale;
-            emphasisState.scaleY = sizeY * hoverScale;
-        }
-
-        symbolPath.scaleX = sizeX * scale;
-        symbolPath.scaleY = sizeY * scale;
+        this.scaleX = this.scaleY = scale;
     }
 
     fadeOut(cb: () => void, opt?: {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org