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

2d text alignment is backwards #1853

Closed
concave-sphere opened this issue Apr 8, 2021 · 3 comments
Closed

2d text alignment is backwards #1853

concave-sphere opened this issue Apr 8, 2021 · 3 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior

Comments

@concave-sphere
Copy link

Bevy version

0.5

Operating system & version

Debian GNU/Linux "buster"

What you did

Inserted text bundles rendering "<HAlign=Left>" with left-alignment and "<HAlign=Right>" with right-alignment, using the same Transform. Did the same for "VAlign\n=\nTop" and "VAlign\n=\nBottom"

What you expected to happen

The Bevy docs describe left and right alignment as follows:

Left: Leftmost character is immediately to the right of the render position.
Bounds start from the render position and advance rightwards.

(...)

Right: Rightmost character is immediately to the left of the render position.
Bounds start from the render position and advance leftwards.

They describe top and bottom alignment as follows:

Top: Characters/bounds start underneath the render position and progress downwards.

Bottom: Characters/bounds start above the render position and progress upward.

This matches my own expectation based on experience with, e.g, word processors, UI libraries, etc. As such, I would expect to see something like this in the center of the screen:

             VAlign
               =
             Bottom
  <HAlign=Right><HAlign=Left>
             VAlign
               =
              Top

Note that the location of the text should be the opposite of its alignment. That is: since the alignment point is in the center of the screen, right-aligned text (text with its right side aligned to the center) should be to the left of center, while left-aligned text (text with its left side aligned to the center) should be to the right of center.

What actually happened

Layout was exactly the opposite of what I expected:

             VAlign
               =
             Top
  <HAlign=Left><HAlign=Right>
             VAlign
               =
              Bottom

Additional information

Program demonstrating the problem: test.tar.gz

Screenshot of the test program above on my computer:

wrong-alignment

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Apr 9, 2021
@illuninocte
Copy link
Contributor

Can i try to take this @alice-i-cecile ?

@alice-i-cecile
Copy link
Member

@CaelumLaron you bet!

@illuninocte illuninocte removed their assignment Jul 26, 2021
@alice-i-cecile
Copy link
Member

Fixed by #6000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

3 participants