From cdd7611394651153d676fef209b9e6f84eb7646f Mon Sep 17 00:00:00 2001 From: ktx-abhay Date: Mon, 21 Oct 2024 17:05:21 +0530 Subject: [PATCH 1/4] fix: tooltip hove issue on rerender --- src/component/tooltip/TooltipHTMLContent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index 7e08b53f98..5fe9465733 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts @@ -461,7 +461,7 @@ class TooltipHTMLContent { getSize() { const el = this.el; - return [el.offsetWidth, el.offsetHeight]; + return [el?.offsetWidth, el?.offsetHeight]; } moveTo(zrX: number, zrY: number) { @@ -469,7 +469,7 @@ class TooltipHTMLContent { makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); if (styleCoord[0] != null && styleCoord[1] != null) { - const style = this.el.style; + const style: any = this.el?.style || {}; const transforms = assembleTransform(styleCoord[0], styleCoord[1]) as string[][]; each(transforms, (transform) => { style[transform[0] as any] = transform[1]; From f86e3cc14c914d511738d776e04abd19a6122663 Mon Sep 17 00:00:00 2001 From: ktx-abhay Date: Tue, 22 Oct 2024 12:36:16 +0530 Subject: [PATCH 2/4] fix: use ternary instead of optional chaining --- src/component/tooltip/TooltipHTMLContent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index 5fe9465733..c00e4df06a 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts @@ -461,7 +461,7 @@ class TooltipHTMLContent { getSize() { const el = this.el; - return [el?.offsetWidth, el?.offsetHeight]; + return el ? [el.offsetWidth, el.offsetHeight] : [0, 0]; } moveTo(zrX: number, zrY: number) { @@ -469,7 +469,7 @@ class TooltipHTMLContent { makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); if (styleCoord[0] != null && styleCoord[1] != null) { - const style: any = this.el?.style || {}; + const style: any = this.el ? (this.el.style || {}) : {} const transforms = assembleTransform(styleCoord[0], styleCoord[1]) as string[][]; each(transforms, (transform) => { style[transform[0] as any] = transform[1]; From dee3f8edd8de548c6a061234a7cd677006e9ab2d Mon Sep 17 00:00:00 2001 From: ktx-abhay Date: Tue, 22 Oct 2024 14:25:34 +0530 Subject: [PATCH 3/4] fix: eslint issue --- src/component/tooltip/TooltipHTMLContent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index c00e4df06a..a6e58e7e9e 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts @@ -469,7 +469,7 @@ class TooltipHTMLContent { makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); if (styleCoord[0] != null && styleCoord[1] != null) { - const style: any = this.el ? (this.el.style || {}) : {} + const style: any = this.el ? (this.el.style || {}) : {}; const transforms = assembleTransform(styleCoord[0], styleCoord[1]) as string[][]; each(transforms, (transform) => { style[transform[0] as any] = transform[1]; From 50b715b216787008904b064a029cff6a15830963 Mon Sep 17 00:00:00 2001 From: ktx-abhay Date: Wed, 23 Oct 2024 12:04:34 +0530 Subject: [PATCH 4/4] remove: unwanted invoke --- src/component/tooltip/TooltipHTMLContent.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts index a6e58e7e9e..27e00d63dc 100644 --- a/src/component/tooltip/TooltipHTMLContent.ts +++ b/src/component/tooltip/TooltipHTMLContent.ts @@ -465,11 +465,14 @@ class TooltipHTMLContent { } moveTo(zrX: number, zrY: number) { + if (!this.el) { + return; + } const styleCoord = this._styleCoord; makeStyleCoord(styleCoord, this._zr, this._container, zrX, zrY); if (styleCoord[0] != null && styleCoord[1] != null) { - const style: any = this.el ? (this.el.style || {}) : {}; + const style = this.el.style; const transforms = assembleTransform(styleCoord[0], styleCoord[1]) as string[][]; each(transforms, (transform) => { style[transform[0] as any] = transform[1];