-
Notifications
You must be signed in to change notification settings - Fork 199
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
fix: 使用离屏 Canvas 测量文本, 提高宽度计算的准确性 close #3018 #3053
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
你好 @lijinke666,非常感谢你的贡献. Hello, @lijinke666, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes. |
Walkthrough此 PR 解决了使用 Changes
|
Size Change: 0 B Total Size: 619 kB ℹ️ View Unchanged
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3053 +/- ##
==========================================
Coverage 75.77% 75.77%
==========================================
Files 257 51 -206
Lines 11994 1490 -10504
Branches 2464 284 -2180
==========================================
- Hits 9088 1129 -7959
+ Misses 1398 210 -1188
+ Partials 1508 151 -1357 ☔ View full report in Codecov by Sentry. |
🎉 This PR is included in version @antv/s2-v2.1.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version @antv/s2-react-v2.1.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
👀 PR includes
🐛 Bugfix
📝 Description
G
的Canvas
, 由于 context 会被污染, 从而导致measureText
的值不准, 需要使用有一个干净 ctx 的离屏 Canvas开启
textWrap
的文本, 由于是逐字计算, 会导致单行文本是否展示省略号不太准确, 尤其是纯数字, 如:11111111
背景见: antvis/G#1876 antvis/G#1879
🖼️ Screenshot
🔗 Related issue link
🔍 Self-Check before the merge