Skip to content

Commit

Permalink
Merge pull request #3723 from VisActor/fix/tooltip-max-width
Browse files Browse the repository at this point in the history
Fix/tooltip max width
  • Loading branch information
xile611 authored Feb 12, 2025
2 parents 68570b1 + 136c22e commit 05db465
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: tooltip should auto wrap when `maxWidth` is valid and `multiLine` is not false, fix #3718\n\n",
"type": "none",
"packageName": "@visactor/vchart"
}
],
"packageName": "@visactor/vchart",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function getTextAttributes(
fontWeight: style.fontWeight,
lineHeight: style.lineHeight as number,
spacing: style.spacing,
multiLine: style.multiLine,
multiLine: isValid(style.maxWidth) ? style.multiLine !== false : style.multiLine,
maxWidth: style.maxWidth,
wordBreak: style.wordBreak,
autoWidth: style.autoWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ export const getTextStyle = (style: ITooltipTextTheme = {}, textStyle: Partial<C
if (isValid(style.fontSize)) {
textStyle.fontSize = getPixelPropertyStr(style.fontSize as number);
}

if (isValid(style.maxWidth)) {
textStyle.maxWidth = getPixelPropertyStr(style.maxWidth as number);
}
if (style.multiLine) {

if (style.multiLine || (isValid(style.maxWidth) && style.multiLine !== false)) {
textStyle.whiteSpace = 'initial';
textStyle.wordBreak = style.wordBreak ?? 'break-word';
} else {
Expand Down

0 comments on commit 05db465

Please sign in to comment.