-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(Text): dont add additional x value for lines #469
Conversation
@@ -28,4 +34,27 @@ describe('Text', () => { | |||
expect(text.layoutEngine.layout.mock.calls).toHaveLength(1); | |||
expect(text.layoutEngine.layout.mock.calls[0][0].string).toBe(''); | |||
}); | |||
|
|||
test('Should render the same rect x value for clones', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont love how this test is constructed. Let me know if you have a better means to test this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is fine! Maybe there's a simpler way, but this is not bad either. Thank you very much!
@@ -28,4 +34,27 @@ describe('Text', () => { | |||
expect(text.layoutEngine.layout.mock.calls).toHaveLength(1); | |||
expect(text.layoutEngine.layout.mock.calls[0][0].string).toBe(''); | |||
}); | |||
|
|||
test('Should render the same rect x value for clones', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is fine! Maybe there's a simpler way, but this is not bad either. Thank you very much!
would it be possible to get a release cut that includes this change? Would love to integrate this back into my project 🙂 |
Definitely! I will release a new fix today. Sorry about the delay |
No worries, I really appreciate your responsiveness and help getting started with the project! |
When Text nodes are cloned, the container is copied over, including x offsets for each line. For
fixed
Text elements, this means that the x value was being accumulated on top of the original rect offset which resulted in this shifting effect that gradually grows worse for each page thefixed
element shows up on.I don't have an exact repro jsx but it would look roughly like this:
Before fix:
After fix:
Fixes #361