You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "plainheart (via GitHub)" <gi...@apache.org> on 2025/05/21 17:39:29 UTC

[PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

plainheart opened a new pull request, #20987:
URL: https://github.com/apache/echarts/pull/20987

   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Fix the markers created by local coord transformer are not removed after the tooltip componet is disposed.
   
   ### Fixed issues
   
   - Resolves #19998
   
   
   ## Details
   
   ### Before: What was the problem?
   
   The markers won't be removed even if the chart is disposed.
   
   ![image](https://github.com/user-attachments/assets/a3fc2702-1db9-41f9-9382-e0d3f08f06b1)
   
   
   ### After: How does it behave after the fixing?
   
   Clean up the markers when the tooltip component is disposed.
   
   ## Document Info
   
   One of the following should be checked.
   
   - [x] This PR doesn't relate to document changes
   - [ ] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   
   
   ## Misc
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   See any test cases about tooltip with `appendTo` or `appendToBody` specified.
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #20987:
URL: https://github.com/apache/echarts/pull/20987#issuecomment-2898744456

   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/echarts/wiki/How-to-make-a-pull-request).
   
   The pull request is marked to be `PR: author is committer` because you are a committer of this project.


-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "100pah (via GitHub)" <gi...@apache.org>.
100pah commented on code in PR #20987:
URL: https://github.com/apache/echarts/pull/20987#discussion_r2115613146


##########
src/component/tooltip/TooltipHTMLContent.ts:
##########
@@ -307,7 +308,9 @@ class TooltipHTMLContent {
                     : isFunction(appendTo) && appendTo(api.getDom())
         );
 
-        makeStyleCoord(this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2);
+        this._clearStyleCoord = makeStyleCoord(
+            this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2
+        );

Review Comment:
   `makeStyleCoord` is called twice in this file, and each call return a `clean` function. 
   But only the last one is called when `dispose`. 
   That still works because the two call of `makeStyleCoord` use the same input `zr` and `container`, but that dependency is not explicit in the API design a little bit.
   
   It's OK to do it like that, but currently I think a better way might be:
   
   Do not change `makeStyleCoord`.
   And a new API: `transformLocalCoordClear` in `zrender/src/core/dom.ts`
   And in `TooltipHTMLContainer.ts`:
   ```ts
   dispose() {
       const zr = this._zr;
       transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
       // ...
   }
   ```
   
   
   
   
   



-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #20987:
URL: https://github.com/apache/echarts/pull/20987#issuecomment-2925362180

   Congratulations! Your PR has been merged. Thanks for your contribution! 👍


-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "plainheart (via GitHub)" <gi...@apache.org>.
plainheart commented on code in PR #20987:
URL: https://github.com/apache/echarts/pull/20987#discussion_r2115713845


##########
src/component/tooltip/TooltipHTMLContent.ts:
##########
@@ -307,7 +308,9 @@ class TooltipHTMLContent {
                     : isFunction(appendTo) && appendTo(api.getDom())
         );
 
-        makeStyleCoord(this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2);
+        this._clearStyleCoord = makeStyleCoord(
+            this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2
+        );

Review Comment:
   This way looks much clear!



-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "100pah (via GitHub)" <gi...@apache.org>.
100pah commented on code in PR #20987:
URL: https://github.com/apache/echarts/pull/20987#discussion_r2115613146


##########
src/component/tooltip/TooltipHTMLContent.ts:
##########
@@ -307,7 +308,9 @@ class TooltipHTMLContent {
                     : isFunction(appendTo) && appendTo(api.getDom())
         );
 
-        makeStyleCoord(this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2);
+        this._clearStyleCoord = makeStyleCoord(
+            this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2
+        );

Review Comment:
   `makeStyleCoord` is called twice in this file, and each call return a `clean` function. 
   But only the last one is called when `dispose`. 
   That still works because the two call of `makeStyleCoord` use the same input `zr` and `container`, but that dependency is not explicit in the API design a little bit.
   
   It's OK to do it like that, but currently I think a better way might be:
   
   Do not change `makeStyleCoord`.
   And a new API: `transformLocalCoordClear` in `zrender/src/core/dom.ts`
   And in `TooltipHTMLContainer.ts`:
   ```ts
   dispose() {
       const zr = this._zr;
       transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
       // ...
   }
   ```
   
   And see https://github.com/ecomfe/zrender/pull/1120#discussion_r2115550946 for transformLocalCoordClear
   
   
   



-- 
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: commits-unsubscribe@echarts.apache.org

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


Re: [PR] fix(tooltip): fix style coord transform markers are not removed after the tooltip is disposed [echarts]

Posted by "100pah (via GitHub)" <gi...@apache.org>.
100pah merged PR #20987:
URL: https://github.com/apache/echarts/pull/20987


-- 
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: commits-unsubscribe@echarts.apache.org

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