Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【WIP】Feat/tooltip label width buffer #2577

Closed
wants to merge 5 commits into from

Conversation

zamhown
Copy link
Member

@zamhown zamhown commented Apr 22, 2024

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 ...

  • 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 zamhown requested a review from xile611 April 22, 2024 13:29
@xile611 xile611 added this to the v1.11.0 milestone Apr 23, 2024
@xile611 xile611 changed the title Feat/tooltip label width buffer 【WIP】Feat/tooltip label width buffer Apr 23, 2024
@xile611
Copy link
Contributor

xile611 commented Apr 23, 2024

优化方案待讨论

@xile611 xile611 closed this May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants