Skip to content
Open
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
30 changes: 25 additions & 5 deletions src/component/tooltip/TooltipRichContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ class TooltipRichContent {
] as const, propName => {
(this.el.style as any)[propName] = tooltipModel.get(propName);
});
zrUtil.each([
'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'
] as const, propName => {
this.el.style[propName] = textStyleModel.get(propName) || 0;
});
applyRichTextStyle(this.el.style, textStyleModel);

this._zr.add(this.el);

Expand Down Expand Up @@ -217,6 +213,30 @@ class TooltipRichContent {
}
}

function applyRichTextStyle(
style: TextStyleProps,
textStyleModel: Model<TooltipOption['textStyle']>
) {
zrUtil.each([
'fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'lineHeight',
'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'
] as const, propName => {
const val = textStyleModel.get(propName);
if (val != null) {
(style as any)[propName] = val;
}
});

const textBorderColor = textStyleModel.get('textBorderColor');
if (textBorderColor != null) {
style.stroke = textBorderColor;
}
const textBorderWidth = textStyleModel.get('textBorderWidth');
if (textBorderWidth != null) {
style.lineWidth = textBorderWidth;
}
}

function mathMaxWith0(val: number): number {
return Math.max(0, val);
}
Expand Down
7 changes: 6 additions & 1 deletion test/tooltip-textStyle.html

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