You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2020/06/09 15:54:39 UTC

[GitHub] [incubator-echarts] plainheart opened a new pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

plainheart opened a new pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781


   
   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Fixes #12778 
   
   ### Fixed issues
   
   - #12778
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   When `enterable` is `true`, tooltip isn't hidden when mouse leaves tooltip content even.
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   ![wrong](https://user-images.githubusercontent.com/26999792/84140783-bb1f0a00-aa84-11ea-9226-aee78e9c603e.gif)
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   We should set `_inContent` to `false` before `hideLater`, please refer to `hideLater` for more infomation.
   
   ![image](https://user-images.githubusercontent.com/26999792/84140898-e4d83100-aa84-11ea-92f8-a5cc08a4263b.png)
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   **Expected result**
   
   ![right](https://user-images.githubusercontent.com/26999792/84140942-f6b9d400-aa84-11ea-9de8-92171a008ec6.gif)
   
   
   
   ## Usage
   
   ### Are there any API changes?
   
   - [ ] The API has been changed.
   
   
   ### Related test cases
   
   Refer to `test/tooltip-enterable.html`
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-echarts] plainheart commented on a change in pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781#discussion_r444577164



##########
File path: src/component/tooltip/TooltipContent.js
##########
@@ -218,12 +218,15 @@ function TooltipContent(container, api, opt) {
         }
     };
     el.onmouseleave = function () {
+        // fix #12778
+        // we should set `_inContent` before `hideLater`
+        self._inContent = false;
+
         if (self._enterable) {
             if (self._show) {
                 self.hideLater(self._hideDelay);

Review comment:
       It seems that we can remove the two judgements about `self._enterable` and `self._show`, `hideLater` will do it.
   
   https://github.com/apache/incubator-echarts/blob/9a2e192c7387663d83e753dc9b8a6c7683e22630/src/component/tooltip/TooltipContent.js#L312-L324
   
   What do you think of it?
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-echarts] chfw commented on a change in pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

Posted by GitBox <gi...@apache.org>.
chfw commented on a change in pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781#discussion_r444530377



##########
File path: src/component/tooltip/TooltipContent.js
##########
@@ -218,12 +218,15 @@ function TooltipContent(container, api, opt) {
         }
     };
     el.onmouseleave = function () {
+        // fix #12778
+        // we should set `_inContent` before `hideLater`
+        self._inContent = false;
+
         if (self._enterable) {
             if (self._show) {
                 self.hideLater(self._hideDelay);

Review comment:
       I felt this hideLater function has a flaw. A function shall not change its behaviour when un-related variable changes.
   
   So basically, hideLater is a trap for next developer. and I do not want to be the next one.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-echarts] plainheart closed pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

Posted by GitBox <gi...@apache.org>.
plainheart closed pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-echarts] echarts-bot[bot] commented on pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781#issuecomment-641221211


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/incubator-echarts/wiki/How-to-make-a-pull-request).


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [incubator-echarts] chfw commented on a change in pull request #12781: fix(tooltip): tooltip should be hidden when mouse leaves tooltip content even if it is enterable, fix #12778.

Posted by GitBox <gi...@apache.org>.
chfw commented on a change in pull request #12781:
URL: https://github.com/apache/incubator-echarts/pull/12781#discussion_r444726379



##########
File path: src/component/tooltip/TooltipContent.js
##########
@@ -218,12 +218,15 @@ function TooltipContent(container, api, opt) {
         }
     };
     el.onmouseleave = function () {
+        // fix #12778
+        // we should set `_inContent` before `hideLater`
+        self._inContent = false;
+
         if (self._enterable) {
             if (self._show) {
                 self.hideLater(self._hideDelay);

Review comment:
       My humble opinion is hideLater function did not do what it claims. A function shall have a single responsibility. HideLater at the moment has two responsibilities, hence it made the code complex to read and prone to bug.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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