Fix visual_bounding_rect for rotated text#7050
Merged
emilk merged 1 commit intoemilk:mainfrom May 18, 2025
Merged
Conversation
lucasmerlin
approved these changes
May 16, 2025
Collaborator
lucasmerlin
left a comment
There was a problem hiding this comment.
Nice, thanks for adding a test!
|
Preview available at https://egui-pr-preview.github.io/pr/7050-pmarkstext-bb-rotation |
visual_bounding_rect for rotated text
darkwater
pushed a commit
to darkwater/egui
that referenced
this pull request
Aug 24, 2025
TextShape.visual_bounding_rect was not taking the text rotation into account. I manually tested drawing the new bounding box on top of the text for various rotations & anchor settings. For example: <img width="191" alt="image" src="https://github.com/user-attachments/assets/56528fc7-7e7d-45af-b92a-c1cd307ff205" /> The unit test I added will fail without this patch, but perhaps doesn't add much value. * [x] I have followed the instructions in the PR template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TextShape.visual_bounding_rect was not taking the text rotation into account. I manually tested drawing the new bounding box on top of the text for various rotations & anchor settings. For example:

The unit test I added will fail without this patch, but perhaps doesn't add much value.