-
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: 修复单元格宽度为浮点数时单元格之间有几率出现多余空隙的问题 close #3014 #3066
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. |
WalkthroughThis PR addresses a bug where cells with floating-point widths in the S2 library rendered with extra gaps due to rounding issues in the underlying G library. The solution involves rounding the width and height values to ensure consistent rendering without gaps. Changes
🪧 TipsFor further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. |
|
||
export function floor(value: number, precision = 2) { | ||
return innerFloor(value, precision); | ||
} | ||
|
||
export function round(value: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the round
function is correctly handling non-numeric inputs by returning the input value unchanged. This is crucial for preventing unexpected behavior in the application.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3066 +/- ##
==========================================
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. |
Size Change: +47 B (+0.01%) Total Size: 619 kB
ℹ️ View Unchanged
|
🎉 This PR is included in version @antv/s2-v2.1.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
👀 PR includes
🐛 Bugfix
📝 Description
背景见 #3014 (comment)
G 的底层默认有取整处理, 对于 S2 单元格来说, 如果宽度是浮点数
199.2
, 实际渲染的可能是200
, 会导致有1px
偏差, 出现多余空隙.解法: 将宽高统一进行向下取整处理
🖼️ Screenshot
🔗 Related issue link
🔍 Self-Check before the merge