You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/04/19 02:57:54 UTC

[echarts] 01/01: fix(map): ensure children have been added to group before calling `resetEventTriggerForRegion`, resolves #14699.

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

wangzx pushed a commit to branch fix/map-tooltip
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 29e85f785656612df0da70dcd95f7592b8388f04
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Mon Apr 19 10:52:51 2021 +0800

    fix(map): ensure children have been added to group before calling `resetEventTriggerForRegion`, resolves #14699.
---
 src/component/helper/MapDraw.ts | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index aefc310..c73dabd 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -252,11 +252,23 @@ class MapDraw {
             // will make them share the same label and bring trouble in label
             // location calculation.
             let regionGroup = nameMap.get(regionName);
+            const hasRegionGroup = !!regionGroup;
 
-            if (!regionGroup) {
+            if (!hasRegionGroup) {
                 regionGroup = nameMap.set(regionName, new graphic.Group() as RegionsGroup);
                 regionsGroup.add(regionGroup);
+            }
+
+            const compoundPath = new graphic.CompoundPath({
+                segmentIgnoreThreshold: 1,
+                shape: {
+                    paths: []
+                }
+            });
+            regionGroup.add(compoundPath);
 
+            if (!hasRegionGroup) {
+                // ensure children have been added to group before calling resetEventTriggerForRegion
                 resetEventTriggerForRegion(
                     viewBuildCtx, regionGroup, regionName, regionModel, mapOrGeoModel, dataIdx
                 );
@@ -268,14 +280,6 @@ class MapDraw {
                 );
             }
 
-            const compoundPath = new graphic.CompoundPath({
-                segmentIgnoreThreshold: 1,
-                shape: {
-                    paths: []
-                }
-            });
-            regionGroup.add(compoundPath);
-
             zrUtil.each(region.geometries, function (geometry) {
                 if (geometry.type !== 'polygon') {
                     return;

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