-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Fix item positioning, text alignment & unwanted clipping of ItemList items #88577
Fix item positioning, text alignment & unwanted clipping of ItemList items #88577
Conversation
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.
When making #88370 I encountered several minor nuisances that I feel like this PR addresses.
The code also looks cleaner and I feel like users would appreciate this, even if it would ever-so-slightly change how ItemLists look.
Still requires testing to make sure nothing silly is overlooked.
f22f48b
to
4e9abb9
Compare
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.
Tested locally in the editor and control gallery demo project, it works as expected. However, in the default project theme used by the control gallery demo project, vertical spacing is now reduced, which makes it harder to click individual items:
Before | After |
---|---|
scene/resources/default_theme.cpp
needs to be modified to increase ItemList's v_separation
constant to get a similar appearance to before.
We should make sure the change in how ItemList's v_separation
theme item is interpreted is clearly documented in the release notes though, as existing themes will need to double the value for the current appearance to be retained. As such, we should avoid cherry-picking this PR to 4.2
.
Indeed, I forgot to adjust the default theme after the vertical spacing fix. Will have a look. I don't think some smaller item height makes the thing harder to click, on the opposite it becomes less small-screen-friendly and requires more work when using the default theme in a low-res, scaled-up game. But I agree with your point that we should avoid breaking existing projects appearance as much as possible and limit those to more important version upgrades. I have additional fixes and improvements that I plan to build on top of this work, btw. |
b0007e6
to
eb65b28
Compare
eb65b28
to
f63728c
Compare
I limited the blast radius of this refactoring so that we can merge it in 4.2. Perhaps I can revert the v_separation to use the old 2x behavior to avoid breaking current themes. What do you think? Saying this because I have other points to refactor that can break existing themes, and I want to deliver those in a different PR that would wait for the correct timing for such changes. This PR would have not point then as it is considered breaking in the current state. |
Thanks! |
Implements part of the fixes mentioned in #88217
The following points are fixed:
For the sake of consistency, the horizontal separation which did nothing on list rows (non-grid) mode is now acting like an internal padding, the same way it does for grid items.
This is a rewrite of the positioning algorithm so that internal calculation of item positions now corresponds to the actual screen rendering.
In the base situation before this fix, items positions are calculated with a gap in mind then grown on the four sides to cover that gap. This is responsible of the clipped selection indicators.
With this fix applied, the position calculation takes into account an appropriate padding to give the same effect as in the initial situation, and positions them correctly to align with the container borders without unwanted clippings and paddings.
No more clipping at the top and left
No more extra gap at the bottom
Text is correctly centered within grid items
Row items can have horizontal padding, leveraging the h_separation parameter that was not taken into account in this mode