Add horizontal alignment support to RichTextLabel#6472
Open
Kofeecheks wants to merge 1 commit intospace-wizards:masterfrom
Open
Add horizontal alignment support to RichTextLabel#6472Kofeecheks wants to merge 1 commit intospace-wizards:masterfrom
Kofeecheks wants to merge 1 commit intospace-wizards:masterfrom
Conversation
Added Align to RichTextLabel and passed it into RichTextEntry.Draw(). Updated RichTextEntry to calculate line widths and apply horizontal offsets so wrapped rich text can be centered or right-aligned correctly.
Contributor
|
This needs screenshots of:
|
Author
This pull request is part of the effort to add a table and content rendering system to the Media Wiki for the Russian server. |
Author
|
@moonheart08 you can merge? |
Contributor
|
I can't easily review this video and need to spend time testing this myself when I have time unless screenshots and ideally a UITestControl page are provided for demonstrating this works. |
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.
Robust.Client/UserInterface/Controls/RichTextLabel.cs
Added Align property to RichTextLabel with Left as the default behavior.
Updated the draw path to pass the requested alignment into RichTextEntry.Draw(...).
Robust.Client/UserInterface/RichTextEntry.cs
Extended Draw(...) to support horizontal alignment at the rich-text layout level.
Added per-line width calculation so wrapped text is aligned line by line instead of shifting the whole text block.
Updated baseline positioning on line breaks to apply Center / Right offsets correctly.
Refactored ProcessNode(...) to take tagsAllowed explicitly so the new draw and measurement paths can reuse the same parsing logic.
Result
RichTextLabel now supports correct horizontal alignment for wrapped rich text, including multi-line content and inline controls, while preserving existing left-aligned behavior by default.