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: [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