Skip to content

Commit 7671365

Browse files
committed
fix: fix bug of tooltip hiden when componentShowContent
1 parent 7599112 commit 7671365

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/vchart/src/component/tooltip/tooltip.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class Tooltip extends BaseComponent<any> implements ITooltip {
454454

455455
if (res === 'unShowByOption') {
456456
success[type] = 'unShowByOption';
457-
} else {
457+
} else if (res) {
458458
success[type] = true;
459459
break;
460460
}
@@ -472,14 +472,10 @@ export class Tooltip extends BaseComponent<any> implements ITooltip {
472472
}
473473

474474
/* 如果还是不应该显示tooltip,则隐藏上一次tooltip */
475-
if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) {
475+
if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil(dimensionInfo))) {
476476
// 如果 tooltip 类型都不是 'unShowByOption',则隐藏上一次 tooltip
477477
// 否则,不隐藏上一次 tooltip ,tooltip 不展示属于 'unShowByOption' 类型的情况
478-
if (
479-
success.mark !== 'unShowByOption' &&
480-
success.dimension !== 'unShowByOption' &&
481-
success.group !== 'unShowByOption'
482-
) {
478+
if (!this._cacheActiveType || success[this._cacheActiveType as TooltipActiveType] !== 'unShowByOption') {
483479
this._handleChartMouseOut(params);
484480
}
485481
} else {
@@ -648,6 +644,7 @@ export class Tooltip extends BaseComponent<any> implements ITooltip {
648644
const result = showTooltip(datum, options, this);
649645
if (result !== 'none') {
650646
this._alwaysShow = !!options?.alwaysShow;
647+
this._cacheActiveType = result;
651648
}
652649
return result;
653650
}

0 commit comments

Comments
 (0)