Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/component/tooltip/TooltipHTMLContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ class TooltipHTMLContent {
private _enterable = true;
private _zr: ZRenderType;

private _alwaysShowContent: boolean = false;
private _hideTimeout: number;
/**
* Hide delay time
Expand Down Expand Up @@ -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') || '';

Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/component/tooltip/TooltipRichContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class TooltipRichContent {

private _hideTimeout: number;

private _alwaysShowContent: boolean = false;

private _enterable = true;

private _inContent: boolean;
Expand All @@ -56,6 +58,9 @@ class TooltipRichContent {
update(tooltipModel: Model<TooltipOption>) {
const alwaysShowContent = tooltipModel.get('alwaysShowContent');
alwaysShowContent && this._moveIfResized();

// update alwaysShowContent
this._alwaysShowContent = alwaysShowContent;
}

show() {
Expand Down Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions src/component/tooltip/TooltipView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ class TooltipView extends ComponentView {

private _api: ExtensionAPI;

private _alwaysShowContent: boolean;

private _tooltipContent: TooltipHTMLContent | TooltipRichContent;

private _refreshUpdateTimeout: number;
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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'));
}

Expand Down
265 changes: 265 additions & 0 deletions test/tooltip-alwaysShowContent.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.