Skip to content

Commit 43dd693

Browse files
committed
fix(tooltip): use transformLocalCoordClear to clear transform style markers when disposing tooltip
1 parent 1767746 commit 43dd693

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/component/tooltip/TooltipHTMLContent.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import { isString, indexOf, each, bind, isFunction, isArray, isDom, retrieve2 } from 'zrender/src/core/util';
2121
import { normalizeEvent } from 'zrender/src/core/event';
22-
import { transformLocalCoord } from 'zrender/src/core/dom';
22+
import { transformLocalCoord, transformLocalCoordClear } from 'zrender/src/core/dom';
2323
import env from 'zrender/src/core/env';
2424
import { convertToColorString, toCamelCase, normalizeCssArray } from '../../util/format';
2525
import type ExtensionAPI from '../../core/ExtensionAPI';
@@ -239,7 +239,7 @@ function makeStyleCoord(
239239
const zrViewportRoot = zrPainter && zrPainter.getViewportRoot();
240240
if (zrViewportRoot) {
241241
// Some APPs might use scale on body, so we support CSS transform here.
242-
return transformLocalCoord(out, zrViewportRoot, container, zrX, zrY);
242+
transformLocalCoord(out, zrViewportRoot, container, zrX, zrY);
243243
}
244244
}
245245
else {
@@ -277,7 +277,6 @@ class TooltipHTMLContent {
277277
private _show: boolean = false;
278278

279279
private _styleCoord: [number, number, number, number] = [0, 0, 0, 0];
280-
private _clearStyleCoord: ReturnType<typeof makeStyleCoord>;
281280

282281
private _enterable = true;
283282
private _zr: ZRenderType;
@@ -322,9 +321,7 @@ class TooltipHTMLContent {
322321
: isFunction(appendTo) && appendTo(api.getDom())
323322
);
324323

325-
this._clearStyleCoord = makeStyleCoord(
326-
this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2
327-
);
324+
makeStyleCoord(this._styleCoord, zr, container, api.getWidth() / 2, api.getHeight() / 2);
328325

329326
(container || api.getDom()).appendChild(el);
330327

@@ -491,7 +488,7 @@ class TooltipHTMLContent {
491488
return;
492489
}
493490
const styleCoord = this._styleCoord;
494-
this._clearStyleCoord = makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY);
491+
makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY);
495492

496493
if (styleCoord[0] != null && styleCoord[1] != null) {
497494
const style = this.el.style;
@@ -553,14 +550,15 @@ class TooltipHTMLContent {
553550
clearTimeout(this._hideTimeout);
554551
clearTimeout(this._longHideTimeout);
555552

556-
this._clearStyleCoord && this._clearStyleCoord();
553+
const zr = this._zr;
554+
transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container);
557555

558556
if (this.el) {
559557
const parentNode = this.el.parentNode;
560558
parentNode && parentNode.removeChild(this.el);
561559
}
562560

563-
this._clearStyleCoord = this.el = this._container = null;
561+
this.el = this._container = null;
564562
}
565563

566564
}

0 commit comments

Comments
 (0)