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

fix: line break position does not take into account newline characters #1883

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

wang1212
Copy link
Member

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / Document optimization
  • TypeScript definition update
  • Refactoring
  • Performance improvement
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

#1833

💡 Background and solution

see #1876

When correcting the calculation of line break positions, line breaks were not taken into account, resulting in abnormal display when line breaks existed in the final rendered text.

Before

image

After

image

📝 Changelog

Language Changelog
🇺🇸 English fix: line break position does not take into account newline characters
🇨🇳 Chinese fix: 换行位置计算未考虑换行符

☑️ Self Check before Merge

  • 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

Copy link

Walkthrough

This pull request addresses a bug where line break positions were not correctly calculated, leading to display issues when newline characters were present in the rendered text. The fix ensures that newline characters are considered in the calculation, improving text rendering.

Changes

File Summary
.changeset/sour-hornets-turn.md Added a changeset entry for the bug fix related to line break positions.
tests/demos/bugfix/textWordWrap.ts Modified test case to adjust maxLines and wordWrapWidth to reflect the changes in line break handling.
packages/g-lite/src/services/TextService.ts Updated the text wrapping logic to account for newline characters when calculating line break positions.

@wang1212 wang1212 merged commit 1424824 into release Dec 27, 2024
2 checks passed
@wang1212 wang1212 deleted the fix-1833 branch December 27, 2024 04:00
wang1212 added a commit that referenced this pull request Dec 27, 2024
* fix: line break position does not take into account newline characters (#1883)

* chore(release): bump version (#1884)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants