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

stretch seems to ignore Text measurements #44

Open
hecrj opened this issue Jun 10, 2019 · 0 comments
Open

stretch seems to ignore Text measurements #44

hecrj opened this issue Jun 10, 2019 · 0 comments
Labels
help wanted Extra attention is needed improvement An internal improvement

Comments

@hecrj
Copy link
Owner

hecrj commented Jun 10, 2019

If we stop the Text widget from filling the width of its parent by default and its parent aligns items using Align::Start (the default), Text just keeps growing horizontally with no limit:

image

I don't think this issue can be produced with the current API, so this is an improvement instead of a bug for now.

It seems that stretch chooses the wrong bounding box for the Node. Text should shrink and have its own width, while filling horizontal space of its parent when possible. Maybe I am wrong, but I think that is the whole point of measure functions.

Additionally, when I implemented the Text widget, I noticed that stretch was calling the measure function provided in Node::with_measure way too many times. I was able to optimize this by using a RefCell to cache the first measurement, which seems to be the only one that matters. This last assumption could be wrong, but toggling this optimization seems to have no effect on the issue described above.

In any case, I think both things could be related. We should try to create a simple test in the stretch codebase reproducing the problem and open an issue/PR.

@hecrj hecrj added improvement An internal improvement help wanted Extra attention is needed labels Jun 10, 2019
@hecrj hecrj changed the title stretch seems to measure Text wrong stretch seems to ignore Text measurements Jun 10, 2019
@hecrj hecrj mentioned this issue Jun 10, 2019
24 tasks
@hecrj hecrj added bug Something isn't working improvement An internal improvement and removed improvement An internal improvement bug Something isn't working labels Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed improvement An internal improvement
Projects
None yet
Development

No branches or pull requests

1 participant