Conversation
Merge origin/main into origin/dev
Merge origin/main into origin/dev
Merge origin/main into origin/dev
* fix: correct letter spacing calculation in text component * chore: update * chore: update
fix: text component shadow color setting
fix: improve floating-point precision handling in bernstein function
fix: rich text wrap width calculation issue
Merge origin/dev into origin/main
docs: changelog 2.8.8
📝 WalkthroughWalkthroughThis release bumps the version from 2.8.7 to 2.8.8 across all packages and includes four bug fixes: per-line letter spacing in text component, shadow color reading from textStyle, removal of scaleFactor parameter from wrap strategies, and rich text initialization refactoring. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/effects-core/src/plugins/text/text-item.ts (1)
216-252:⚠️ Potential issue | 🟡 MinorAvoid adding letter spacing before wrap/newline decisions.
Spacing is currently applied before wrap/newline checks, which can add a trailing space to the previous line’s width and slightly skew alignment. Consider applying spacing only when the character is actually placed on the current line.🧩 Suggested adjustment
- // 和浏览器行为保持一致 - // 字符间距只应用在字符之间,每行第一个字符不加间距 - if (charCountInLine > 0) { - x += letterSpace; - } + const isNewLine = str === '\n'; + let spacing = charCountInLine > 0 ? letterSpace : 0; // 处理文本结束行为 if (overflow === spec.TextOverflow.display) { - if (str === '\n') { + if (isNewLine) { lineCount++; x = 0; charCountInLine = 0; } else { - x += textMetrics; + x += spacing + textMetrics; charCountInLine++; this.maxLineWidth = Math.max(this.maxLineWidth, x); } } else { - if (((x + textMetrics) > width && i > 0) || str === '\n') { + if (((x + spacing + textMetrics) > width && i > 0) || isNewLine) { lineCount++; this.maxLineWidth = Math.max(this.maxLineWidth, x); x = 0; charCountInLine = 0; + spacing = 0; } - if (str !== '\n') { - x += textMetrics; + if (!isNewLine) { + x += spacing + textMetrics; charCountInLine++; } }- // 和浏览器行为保持一致 - // 字符间距只应用在字符之间,每行第一个字符不加间距 - if (charsArray.length > 0) { - x += layout.letterSpace * fontScale; - } - - if (((x + textMetrics.width) > baseWidth && i > 0) || str === '\n') { + const isNewLine = str === '\n'; + let spacing = charsArray.length > 0 ? layout.letterSpace * fontScale : 0; + if (((x + spacing + textMetrics.width) > baseWidth && i > 0) || isNewLine) { charsInfo.push({ y, width: x, chars: charsArray, charOffsetX, }); x = 0; y += lineHeight; charsArray = []; charOffsetX = []; + spacing = 0; } - if (str !== '\n') { + if (!isNewLine) { + if (spacing > 0) { + x += spacing; + } charsArray.push(str); charOffsetX.push(x); x += textMetrics.width; }Also applies to: 433-456
Summary by CodeRabbit
Release Notes - Version 2.8.8
Bug Fixes
Documentation