plainheart commented on code in PR #18436:
URL: https://github.com/apache/echarts/pull/18436#discussion_r1150881659


##########
src/component/tooltip/TooltipHTMLContent.ts:
##########
@@ -291,14 +291,21 @@ class TooltipHTMLContent {
         (el as any).domBelongToZr = true;
         this.el = el;
         const zr = this._zr = api.getZr();
-        const appendToBody = this._appendToBody = opt && opt.appendToBody;
 
-        makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, 
api.getHeight() / 2);
-
-        if (appendToBody) {
-            document.body.appendChild(el);
+        let customContainer: HTMLElement | null
+        if (opt && opt.appendToBody) {
+            customContainer = this._customContainer = document.body
+        } else if (opt && opt.getAppendElement) {

Review Comment:
   Thanks for your contribution! But I think it's needed to get a better design 
on the API naming and implementation.
   
   For example, it looks good to me if we call it `teleport` and the 
`customContainer` could be named by `container`. If no specified container, it 
fallbacks to `api.getDom()`, that is, the chart container. 
https://github.com/apache/echarts/blob/c4efc1fb1dd9bfda804804ba9eaff14a8846ff51/src/component/tooltip/TooltipView.ts#L174



-- 
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-unsubscr...@echarts.apache.org

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


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

Reply via email to