-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Handle Grid * expansion when size is larger than minimum, but less than sufficient to display full size #14902
Conversation
…ltiple arrange stuff
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines. |
Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines. |
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 there's still an issue on iOS here
I've rebased on main and used the code you have here
#14694
Okay, should be fixed now. The changes were pointing up a long-standing problem with the ContentView/LayoutView backing controls, where they were measuring unnecessarily during LayoutSubviews. |
…an sufficient to display full size (#14902) * Add tests for overlapping stuff, checkpoint before working out the multiple arrange stuff * Working, just needs a lot of cleanup * More cleanup * Break down decompress method * Add test for multiple Arrange calls * More comprehensive test for multiple Arrange calls * No longer need the Available* methods * Pare down star decompression * Fix empty star row/column error * Make the grid structure methods clearer in their purpose * Remove return from ResolveStars * Auto-format source code * Account for greedy control measurement behavior * Auto-format source code * Remove extraneous using * Prevent unnecessary LayoutSubviews in xplat backing controls --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
/backport to net7.0 |
Started backporting to net7.0: https://github.com/dotnet/maui/actions/runs/5270861797 |
@hartez backporting to net7.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Add tests for overlapping stuff, checkpoint before working out the multiple arrange stuff
Applying: Working, just needs a lot of cleanup
error: sha1 information is lacking or useless (src/Core/src/Layouts/GridLayoutManager.cs).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 Working, just needs a lot of cleanup
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
@hartez an error occurred while backporting to net7.0, please check the run log for details! Error: git am failed, most likely due to a merge conflict. |
…an sufficient to display full size (#14902) * Add tests for overlapping stuff, checkpoint before working out the multiple arrange stuff * Working, just needs a lot of cleanup * More cleanup * Break down decompress method * Add test for multiple Arrange calls * More comprehensive test for multiple Arrange calls * No longer need the Available* methods * Pare down star decompression * Fix empty star row/column error * Make the grid structure methods clearer in their purpose * Remove return from ResolveStars * Auto-format source code * Account for greedy control measurement behavior * Auto-format source code * Remove extraneous using * Prevent unnecessary LayoutSubviews in xplat backing controls --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
…an sufficient to display full size (#14902) (#15653) * Add tests for overlapping stuff, checkpoint before working out the multiple arrange stuff * Working, just needs a lot of cleanup * More cleanup * Break down decompress method * Add test for multiple Arrange calls * More comprehensive test for multiple Arrange calls * No longer need the Available* methods * Pare down star decompression * Fix empty star row/column error * Make the grid structure methods clearer in their purpose * Remove return from ResolveStars * Auto-format source code * Account for greedy control measurement behavior * Auto-format source code * Remove extraneous using * Prevent unnecessary LayoutSubviews in xplat backing controls --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
…an sufficient to display full size (#14902) --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
…an sufficient to display full size (#14902) --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
* Handle Grid * expansion when size is larger than minimum, but less than sufficient to display full size (#14902) --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com> * Fix incorrect calculation of expansion size when *s have different scalars (#15532) Fixes #15494 --------- Co-authored-by: E.Z. Hart <hartez@gmail.com> Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
* Handle Grid * expansion when size is larger than minimum, but less than sufficient to display full size (#14902) --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com> * Fix incorrect calculation of expansion size when *s have different scalars (#15532) Fixes #15494 --------- Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com> Co-authored-by: Rui Marinho <me@ruimarinho.net>
Description of Change
(This is an expansion of the fix in #14114, which handled part of this problem on Windows, but didn't successfully fix it on Android and iOS. It also caused havoc in several other layout situations.)
When a Grid with * rows/columns is measured, the measurement should return the minimal values for those rows/columns to contain their content. When the Grid is arranged, those *s should (in some situations) be expanded to fill in the extra space if the arranged size is larger than the measured size. The size of those *s should be maxed out at what the Grid constraints allow for, and should not grow past that even if the contained controls return overly large sizes from measure (the situation described in #14818).
However - that expansion should not automatically be to the full potential size of the * rows/columns if the target size is not sufficient to contain it. Instead, the expansion should be distributed among the available space so that the smallest * rows/columns expand at the greatest rate until all rows/columns can be expanded to their full size.
This PR handles that expansion properly, and also avoids the rounding errors described in #14694. This includes smoothly expanding as the window size is changed in environments (e.g., Desktop) where that's an issue. This also adds tests for the problem behavior in #14818, and does not allow controls to force the sizes of their * rows/columns beyond the confines of the Grid.
In this PR:
Issues Fixed
Fixes #14694
Fixes #14818