antvis/G6

The issue has been closed
[V5] label 使用padding并且折行的情况下,background宽度不能覆盖全部文字内容 #6051
xuwb posted onGitHub
Describe the bug / 问题描述
label 使用padding并且折行的情况下,background宽度不能覆盖全部文字内容。
查看了下 label.ts 源码,这里宽度的计算好像有点问题。
Object.assign(backgroundStyle, { x: minX - left, y: minY - top, width: wordWrap ? Math.min(totalWidth, wordWrapWidth) : totalWidth, height: halfHeight * 2 + top + bottom, });
是不是可以改成 width: wordWrap ? Math.min(totalWidth, wordWrapWidth + left + right) : totalWidth,
或者不做判断直接用 totalWidth 好像也可以 width: totalWidth
G6 Version / G6 版本
🆕 5.x
Operating System / 操作系统
macOS
Browser / 浏览器
Chrome
Additional context / 补充说明
No response