diff --git a/src/component/tooltip/TooltipHTMLContent.ts b/src/component/tooltip/TooltipHTMLContent.ts
index 02496857b0..b326acd091 100644
--- a/src/component/tooltip/TooltipHTMLContent.ts
+++ b/src/component/tooltip/TooltipHTMLContent.ts
@@ -262,6 +262,7 @@ class TooltipHTMLContent {
private _enterable = true;
private _zr: ZRenderType;
+ private _alwaysShowContent: boolean = false;
private _hideTimeout: number;
/**
* Hide delay time
@@ -360,6 +361,9 @@ class TooltipHTMLContent {
const alwaysShowContent = tooltipModel.get('alwaysShowContent');
alwaysShowContent && this._moveIfResized();
+ // update alwaysShowContent
+ this._alwaysShowContent = alwaysShowContent;
+
// update className
this.el.className = tooltipModel.get('className') || '';
@@ -488,7 +492,7 @@ class TooltipHTMLContent {
}
hideLater(time?: number) {
- if (this._show && !(this._inContent && this._enterable)) {
+ if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
if (time) {
this._hideDelay = time;
// Set show false to avoid invoke hideLater multiple times
diff --git a/src/component/tooltip/TooltipRichContent.ts b/src/component/tooltip/TooltipRichContent.ts
index c78da5ef49..d8f038dcbf 100644
--- a/src/component/tooltip/TooltipRichContent.ts
+++ b/src/component/tooltip/TooltipRichContent.ts
@@ -37,6 +37,8 @@ class TooltipRichContent {
private _hideTimeout: number;
+ private _alwaysShowContent: boolean = false;
+
private _enterable = true;
private _inContent: boolean;
@@ -56,6 +58,9 @@ class TooltipRichContent {
update(tooltipModel: Model) {
const alwaysShowContent = tooltipModel.get('alwaysShowContent');
alwaysShowContent && this._moveIfResized();
+
+ // update alwaysShowContent
+ this._alwaysShowContent = alwaysShowContent;
}
show() {
@@ -190,7 +195,7 @@ class TooltipRichContent {
}
hideLater(time?: number) {
- if (this._show && !(this._inContent && this._enterable)) {
+ if (this._show && !(this._inContent && this._enterable) && !this._alwaysShowContent) {
if (time) {
this._hideDelay = time;
// Set show false to avoid invoke hideLater multiple times
diff --git a/src/component/tooltip/TooltipView.ts b/src/component/tooltip/TooltipView.ts
index e64c2d19d4..82a222cb1d 100644
--- a/src/component/tooltip/TooltipView.ts
+++ b/src/component/tooltip/TooltipView.ts
@@ -147,8 +147,6 @@ class TooltipView extends ComponentView {
private _api: ExtensionAPI;
- private _alwaysShowContent: boolean;
-
private _tooltipContent: TooltipHTMLContent | TooltipRichContent;
private _refreshUpdateTimeout: number;
@@ -196,12 +194,6 @@ class TooltipView extends ComponentView {
this._api = api;
- /**
- * @private
- * @type {boolean}
- */
- this._alwaysShowContent = tooltipModel.get('alwaysShowContent');
-
const tooltipContent = this._tooltipContent;
tooltipContent.update(tooltipModel);
tooltipContent.setEnterable(tooltipModel.get('enterable'));
@@ -396,7 +388,7 @@ class TooltipView extends ComponentView {
) {
const tooltipContent = this._tooltipContent;
- if (!this._alwaysShowContent && this._tooltipModel) {
+ if (this._tooltipModel) {
tooltipContent.hideLater(this._tooltipModel.get('hideDelay'));
}
diff --git a/test/tooltip-alwaysShowContent.html b/test/tooltip-alwaysShowContent.html
new file mode 100644
index 0000000000..67a1ea3f1b
--- /dev/null
+++ b/test/tooltip-alwaysShowContent.html
@@ -0,0 +1,265 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alwaysShowContent: true
+
+
+
+ alwaysShowContent: true, renderMode: "richText", triggerOn: 'click',
+
+
+
+
+
+
+
+
+