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/09/25 05:32:04 UTC

[incubator-echarts] branch next updated: fix(event): choose the top most element that will will be highlighted

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 6b37266  fix(event): choose the top most element that will will be highlighted
6b37266 is described below

commit 6b37266dbc932e0be26e5f900424b4fc6b5f6928
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Sep 25 13:25:36 2020 +0800

    fix(event): choose the top most element that will will be highlighted
---
 src/echarts.ts | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/echarts.ts b/src/echarts.ts
index d96f45b..f64966b 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -1798,8 +1798,13 @@ class ECharts extends Eventful {
         };
 
         bindMouseEvent = function (zr: zrender.ZRenderType, ecIns: ECharts): void {
+            // Find a dispatcher that's on the most top.
             function getDispatcher(target: Element, det: (target: Element) => boolean) {
-                while (target && !det(target)) {
+                let found;
+                while (target) {
+                    if (det(target)) {
+                        found = target;
+                    }
                     if (target.__hostTarget) {
                         target = target.__hostTarget;
                     }
@@ -1807,7 +1812,7 @@ class ECharts extends Eventful {
                         target = target.parent;
                     }
                 }
-                return target;
+                return found;
             }
             zr.on('mouseover', function (e) {
                 const el = e.target;


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