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

Bad alignment on some screens at 1152x864 (for example) #5040

Closed
Gliese852 opened this issue Dec 2, 2020 · 6 comments · Fixed by #5085
Closed

Bad alignment on some screens at 1152x864 (for example) #5040

Gliese852 opened this issue Dec 2, 2020 · 6 comments · Fixed by #5085

Comments

@Gliese852
Copy link
Contributor

Observed behaviour

everything on animation:
ezgif-4-ee13914edd7e

My pioneer version (and OS):
60b80bc Ubuntu

@gunchleoc
Copy link
Contributor

I think we need a width parameter for textWrapped to fix that.

@Gliese852
Copy link
Contributor Author

@gunchleoc maybe we can use ui.nextItemWidth ?

@gunchleoc
Copy link
Contributor

I don't know - I just navigated to the C++ code from Lua to check whether there was a width parameter and didn't find any. So, the text wrapper doesn't seem to know how much width it really has available.

I'm happy to keep doing smaller fixes as I notice them while testing my translation, but I can't afford the time right now to learn a new code base.

@Gliese852
Copy link
Contributor Author

@gunchleoc try to write ui.nextItemWidth(desired_width) immediately before ui.textWrapped(....), this way you tell the next widget its width.

@Web-eWorks
Copy link
Member

The textWrapped call does in fact know it's width; this is ImGui-internal information that can be queried by ui.getColumnWidth() or ui.getContentRegion().x. The problem is that something in our code or ImGui's code is calculating a different width when we're querying the width of a line of text vs. when we're actually rendering it. It's possible (and looking at that screenshot, I'd say very probable) that we're actually not giving it enough width to render the entire line of text on a single line when we're doing the initial calculation and thus we're getting the width of the first line of wrapped text back.

@gunchleoc
Copy link
Contributor

Looking at the 1MW pulse canon, there also seems to be an alignment problem - maybe some extra whitespace nodes that it can't handle properly when right-aligned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants