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

Adjust flex item position to account for reversal when laying out unconstrained #13936

Merged
merged 3 commits into from
May 15, 2023

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Mar 14, 2023

Description of Change

Like most of Flex, RowReverse/ColumnReverse don't make of a ton of sense when measuring/laying out in unconstrained directions. The implementation of reverse calls for starting at the far edge and laying out in reverse order; when the direction is unconstrained, "far edge" has no meaning. The current implementation treats the unconstrained "far edge" as zero; this means that the reversed items are starting at zero and laying out into negative X,Y positions.

The best option in the absence of a known constraint is to lay out in reverse order from the near edge; the width of the unconstrained container is just the width of the flex items within it. Since the implementation is already almost doing this, we just do a final pass to adjust the positions of the items into positive X,Y positions.

Draft for now; this needs unit tests.

Issues Fixed

Fixes #7756

@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@Eilon Eilon added the area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter label Mar 15, 2023
@hartez hartez marked this pull request as ready for review April 10, 2023 18:40
@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@PureWeen PureWeen self-assigned this May 15, 2023
@PureWeen PureWeen merged commit 8150d01 into main May 15, 2023
@PureWeen PureWeen deleted the fix-7756 branch May 15, 2023 15:34
rmarinho pushed a commit that referenced this pull request May 30, 2023
…onstrained (#13936)

* Adjust flex item position to account for reversal when laying out unconstrained
Fixes #7756

* Add automated tests

* Auto-format source code

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FlexLayout RowReverse doesn't work Properly
3 participants