100pah commented on code in PR #20447:
URL: https://github.com/apache/echarts/pull/20447#discussion_r2049079614


##########
src/component/tooltip/TooltipView.ts:
##########
@@ -472,7 +471,21 @@ class TooltipView extends ComponentView {
 
             let seriesDispatcher: Element;
             let cmptDispatcher: Element;
-            findEventDispatcher(el, (target) => {
+            findEventDispatcher(el, function(target) {
+                // Check if el has any ancestor that has tooltipDisabled: true.
+                let tooltipDisabled = false;
+                let parent = el;
+                while (parent) {
+                    if (parent.tooltipDisabled) {
+                        tooltipDisabled = true;
+                        break;
+                    }
+                    parent = parent.parent;

Review Comment:
   The `findEventDispatcher(` itself travels from the original input 
`el`(include) alone its ancestors.
   Thus it's not appropriate to travel to ancestor in the callback; otherwise a 
`O(depth^2)` travel dose not make much sense.
   I think it can be:
   
   ```ts
               findEventDispatcher(el, (target) => {
                   if (target.tooltipDisabled) {
                       seriesDispatcher = cmptDispatcher = null;
                       return true;
                   }
                   if (seriesDispatcher || cmptDispatcher) {
                       return;
                   }
                   // Always show item tooltip if mouse is on the element with 
dataIndex
                   if (getECData(target).dataIndex != null) {
                       seriesDispatcher = target;
                   }
                   // Tooltip provided directly. Like legend.
                   else if (getECData(target).tooltipConfig != null) {
                       cmptDispatcher = target;
                   }
               }, true);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to