VChart icon indicating copy to clipboard operation
VChart copied to clipboard

【WIP】Feat/tooltip label width buffer

Open zamhown opened this issue 1 year ago • 1 comments

dom tooltip 的多行文本模式,可能会导致一些异常换行。原因是 canvas 的 measureText 的结果和 dom 环境的文本换行阈值不一致(measureText 计算出的宽度比 dom 需要的宽度略小)。 img_v3_02a6_1aad7371-2746-403a-8304-c2b8ebfe946g

考虑支持 extraWidth 属性作为 tooltip 标签宽度的 buffer,在统一布局方法计算出 tooltip 标签宽度后,加上 extraWidth 属性并作用最终的 dom 标签宽度上。这样可以避免异常换行。

extraWidth 属性的默认值设在主题中,用户不用手动设置。

[中文版模板 / Chinese template]

🤔 This is a ...

  • [x] New feature
  • [ ] Bug fix
  • [ ] TypeScript definition update
  • [ ] Bundle size optimization
  • [ ] Performance optimization
  • [ ] Enhancement feature
  • [ ] Refactoring
  • [ ] Update dependency
  • [ ] Code style optimization
  • [ ] Test Case
  • [ ] Branch merge
  • [ ] Release
  • [ ] Site / documentation update
  • [ ] Demo update
  • [ ] Workflow
  • [ ] Other (about what?)

🔗 Related issue link

🔗 Related PR link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • [ ] Doc is updated/provided or not needed
  • [ ] Demo is updated/provided or not needed
  • [ ] TypeScript definition is updated/provided or not needed
  • [ ] Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

zamhown avatar Apr 22 '24 13:04 zamhown

优化方案待讨论

xile611 avatar Apr 23 '24 06:04 xile611