You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2020/11/06 09:14:36 UTC

[incubator-echarts] branch fix/geo-state created (now 40d9419)

This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a change to branch fix/geo-state
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


      at 40d9419  fix: [geo select state] fix that dispatchAction({ type: 'geoToggleSelect', ... }) now work immediately.

This branch includes the following new commits:

     new 40d9419  fix: [geo select state] fix that dispatchAction({ type: 'geoToggleSelect', ... }) now work immediately.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-echarts] 01/01: fix: [geo select state] fix that dispatchAction({ type: 'geoToggleSelect', ... }) now work immediately.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch fix/geo-state
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 40d941924a9d708f2f0cbaaad94a448231aaadee
Author: 100pah <su...@gmail.com>
AuthorDate: Fri Nov 6 17:13:17 2020 +0800

    fix: [geo select state] fix that dispatchAction({ type: 'geoToggleSelect', ... }) now work immediately.
---
 src/component/geo/GeoView.ts |  9 +++------
 src/echarts.ts               |  4 ----
 src/util/types.ts            |  1 -
 test/hoverStyle.html         | 17 ++++++++++++++---
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/component/geo/GeoView.ts b/src/component/geo/GeoView.ts
index a98ef0e..2597733 100644
--- a/src/component/geo/GeoView.ts
+++ b/src/component/geo/GeoView.ts
@@ -25,7 +25,6 @@ import ExtensionAPI from '../../ExtensionAPI';
 import GeoModel from '../../coord/geo/GeoModel';
 import { Payload, ZRElementEvent, ECEventData } from '../../util/types';
 import { getECData } from '../../util/innerStore';
-import { enterSelect, leaveSelect } from '../../util/states';
 
 class GeoView extends ComponentView {
 
@@ -63,7 +62,7 @@ class GeoView extends ComponentView {
 
         this._model = geoModel;
 
-        this.updateSelectStatus();
+        this.updateSelectStatus(geoModel, ecModel, api);
     }
 
     private _handleRegionClick(e: ZRElementEvent) {
@@ -78,19 +77,17 @@ class GeoView extends ComponentView {
             this._api.dispatchAction({
                 type: 'geoToggleSelect',
                 geoId: this._model.id,
-                // mark status to update
-                statusChanged: true,
                 name: eventData.name
             });
         }
     }
 
-    updateSelectStatus() {
+    updateSelectStatus(model: GeoModel, ecModel: GlobalModel, api: ExtensionAPI) {
         this._mapDraw.group.traverse((node) => {
             const eventData = getECData(node).eventData;
             if (eventData) {
                 this._model.isSelected(eventData.name)
-                    ? enterSelect(node) : leaveSelect(node);
+                    ? api.enterSelect(node) : api.leaveSelect(node);
                 // No need to traverse children.
                 return true;
             }
diff --git a/src/echarts.ts b/src/echarts.ts
index 1a3b003..4ea68e9 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -1769,10 +1769,6 @@ class ECharts extends Eventful {
                 }
             });
 
-            if (payload.statusChanged) {
-                markStatusToUpdate(this);
-            }
-
             if (updateMethod !== 'none' && !isStatusChange && !cptType) {
                 // Still dirty
                 if (this[OPTION_UPDATED_KEY]) {
diff --git a/src/util/types.ts b/src/util/types.ts
index 47fa493..c51453e 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -142,7 +142,6 @@ interface PayloadItem {
 export interface Payload extends PayloadItem {
     type: string;
     escapeConnect?: boolean;
-    statusChanged?: boolean;
     batch?: PayloadItem[];
 }
 
diff --git a/test/hoverStyle.html b/test/hoverStyle.html
index 1d85538..48ddc8e 100644
--- a/test/hoverStyle.html
+++ b/test/hoverStyle.html
@@ -613,7 +613,7 @@ under the License.
 
                 var chart = testHelper.create(echarts, 'mainb4', {
                     title: [
-                        'normal style is **line: green dashed width 3, node: red**,',
+                        'normal style is **line: green dashed width 3, node: default color**,',
                         'should become **line: orange solid width 8, node: only "dd" blue** when hovered'
                     ],
                     option: option,
@@ -1018,7 +1018,7 @@ under the License.
                         'trigger hover by API: **should scaled and color-lifted**.',
                         'Test mouse hover and leave, should NOT return to normal.',
                         'Only click downplay to return normal',
-                        'Click the red sector, it **keep scaled and color-lifted**',
+                        'Click the top-right sector, it **keep scaled and color-lifted**',
                         'Only click downplay to return normal'
                     ],
                     option: option,
@@ -1140,7 +1140,18 @@ under the License.
                                 min: 1.5,
                                 max: 10
                             },
-                            selectedMode: 'multiple'
+                            selectedMode: 'multiple',
+                            // emphasis: {
+                            //     itemStyle: {
+                            //         color: 'none',
+                            //         borderWidth: 2
+                            //     }
+                            // },
+                            select: {
+                                itemStyle: {
+                                    color: 'green'
+                                }
+                            }
                         }]
                     };
 


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