Skip to content

Commit 31bd0d0

Browse files
authored
fix: 修复#2279 canvas resize 之后tooltip越界的问题 (#2615)
1 parent 6115367 commit 31bd0d0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/chart/controller/tooltip.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,17 @@ export default class Tooltip extends Controller<TooltipOption> {
323323
if (this.point) {
324324
this.showTooltip(this.point);
325325
}
326+
327+
if (this.tooltip) {
328+
// #2279 修复resize之后tooltip越界的问题
329+
// 确保tooltip已经创建的情况下
330+
const canvas = this.view.getCanvas();
331+
// 更新 region
332+
this.tooltip.set('region', {
333+
start: { x: 0, y: 0 },
334+
end: { x: canvas.get('width'), y: canvas.get('height') },
335+
});
336+
}
326337
}
327338

328339
// 获取 tooltip 配置,因为用户可能会通过 view.tooltip() 重新配置 tooltip,所以就不做缓存,每次直接读取

0 commit comments

Comments
 (0)