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

text: Introduce layout coordinate space and transforms #18448

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Nov 2, 2024

This is a refactor that aims at code simplification and deduplication of logic. Specifically, it introduces the idea of layout coordinate space and implements transforms from local coordinate space to layout coordinate space and vice-versa.

By using these transforms it's easier and less error-prone to get coordinates within text.

This also simplifies text field rendering, pushing only one transform onto the stack instead of two.

After implementing this, I'm fairly certain that is_link_at is also broken, as it doesn't take into account translation resulting from bounds and it incorrectly compensates for the gutter. I'll leave this however for a future fix with tests.

@kjarosh kjarosh added text Issues relating to text rendering/input A-core Area: Core player, where no other category fits T-refactor Type: Refactor / Cleanup labels Nov 2, 2024
@kjarosh kjarosh marked this pull request as draft November 2, 2024 10:52
This makes it possible to collapse two transforms into one.
Layout coordinates define where the whole text layout is rendered,
irrespective of TextField's bounds, gutter, and scrolls.

This patch introduces the idea of layout space and implements matrices
used for translating local space to layout space and vice-versa.
@kjarosh kjarosh marked this pull request as ready for review November 4, 2024 11:21
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core player, where no other category fits T-refactor Type: Refactor / Cleanup text Issues relating to text rendering/input waiting-on-review Waiting on review from a Ruffle team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant