|
19 | 19 |
|
20 | 20 | import { isString, indexOf, each, bind, isFunction, isArray, isDom, retrieve2 } from 'zrender/src/core/util'; |
21 | 21 | import { normalizeEvent } from 'zrender/src/core/event'; |
22 | | -import { transformLocalCoord } from 'zrender/src/core/dom'; |
| 22 | +import { transformLocalCoord, transformLocalCoordClear } from 'zrender/src/core/dom'; |
23 | 23 | import env from 'zrender/src/core/env'; |
24 | 24 | import { convertToColorString, toCamelCase, normalizeCssArray } from '../../util/format'; |
25 | 25 | import type ExtensionAPI from '../../core/ExtensionAPI'; |
@@ -239,7 +239,7 @@ function makeStyleCoord( |
239 | 239 | const zrViewportRoot = zrPainter && zrPainter.getViewportRoot(); |
240 | 240 | if (zrViewportRoot) { |
241 | 241 | // 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); |
243 | 243 | } |
244 | 244 | } |
245 | 245 | else { |
@@ -277,7 +277,6 @@ class TooltipHTMLContent { |
277 | 277 | private _show: boolean = false; |
278 | 278 |
|
279 | 279 | private _styleCoord: [number, number, number, number] = [0, 0, 0, 0]; |
280 | | - private _clearStyleCoord: ReturnType<typeof makeStyleCoord>; |
281 | 280 |
|
282 | 281 | private _enterable = true; |
283 | 282 | private _zr: ZRenderType; |
@@ -322,9 +321,7 @@ class TooltipHTMLContent { |
322 | 321 | : isFunction(appendTo) && appendTo(api.getDom()) |
323 | 322 | ); |
324 | 323 |
|
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); |
328 | 325 |
|
329 | 326 | (container || api.getDom()).appendChild(el); |
330 | 327 |
|
@@ -491,7 +488,7 @@ class TooltipHTMLContent { |
491 | 488 | return; |
492 | 489 | } |
493 | 490 | const styleCoord = this._styleCoord; |
494 | | - this._clearStyleCoord = makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); |
| 491 | + makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); |
495 | 492 |
|
496 | 493 | if (styleCoord[0] != null && styleCoord[1] != null) { |
497 | 494 | const style = this.el.style; |
@@ -553,14 +550,15 @@ class TooltipHTMLContent { |
553 | 550 | clearTimeout(this._hideTimeout); |
554 | 551 | clearTimeout(this._longHideTimeout); |
555 | 552 |
|
556 | | - this._clearStyleCoord && this._clearStyleCoord(); |
| 553 | + const zr = this._zr; |
| 554 | + transformLocalCoordClear(zr && zr.painter && zr.painter.getViewportRoot(), this._container); |
557 | 555 |
|
558 | 556 | if (this.el) { |
559 | 557 | const parentNode = this.el.parentNode; |
560 | 558 | parentNode && parentNode.removeChild(this.el); |
561 | 559 | } |
562 | 560 |
|
563 | | - this._clearStyleCoord = this.el = this._container = null; |
| 561 | + this.el = this._container = null; |
564 | 562 | } |
565 | 563 |
|
566 | 564 | } |
|
0 commit comments