-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Align sidebar widget values to the left by default #54905
Align sidebar widget values to the left by default #54905
Conversation
Good catch - I noticed something similar going on with the "Vital Numbers" section; I think it's an unwanted side-effect of #54628 which added the alignment options, but haven't looked into the cause/solution. I think it's out of the scope of this PR, but definitely needs fixing. @dseguin let me know if you have any ideas. |
So some of this is a side-effect of the alignment, since widgets in the same "rows" layout will try to align with each other using the longest label as a guide: That also means that if the label is really long, left-aligned widgets in the "rows" layout are pushed even further into the next column's space: I think that a reasonable fix would be to cut off the widget if it crosses it's max width, ex: The other stuff is probably due to some jankiness in the padding code (which is kinda messy at the moment). I refactored a lot of it in #54693, but I can break that out into a separate PR if it fixes the issue. |
Well, that was easy :P diff --git a/src/widget.cpp b/src/widget.cpp
index 9c708caff7..ee7fe5bac4 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1302,6 +1302,6 @@ std::string widget::layout( const avatar &ava, const unsigned int max_width, int
row_num == 0 ? label_width : 0, _text_align, _label_align );
}
}
- return ret;
+ return ret.find( '\n' ) != std::string::npos ? ret : trim_by_length( ret, max_width );
} |
It would also be nice to mark all the strings for translation with the upper character limit for translators, if possible, that would ease up the translations for sure |
Also, I was able to fix the general issue of values not having enough space, due to the alignment of the longest label: I made it so that values start to eat the free space next to the label if they don't have enough room (leaving at least one space after the label). I'll create a separate PR with the fixes. |
6b855b7
to
91e2aca
Compare
Revised "After" screenshot, after merging the fix for issue #54915: |
Summary
Features "Align sidebar widget values to the left by default"
Purpose of change
Widget values are often too far away from their labels with the default alignment (labels to the left, values to the right).
This also causes widgets to look quite different from the old hardcoded ones players may be more familiar with.
Describe the solution
text_align
beleft
by default, the same aslabel_align
. This is a 1-line change.Describe alternatives you've considered
I do think the right-aligned (full-justified) values are more aesthetically pleasing and balanced-looking, but when used indiscriminately down the whole sidebar (as they currently are) it leads to this big chasm of black-space that is difficult for the eye to jump across.
If the sub-sections were more carefully crafted to fill out their horizontal space better, then the full-justified alignment could be applied to those sections for a better overall result. But with an arbitrary amount of space between label and value, this kind of alignment makes a poor default.
Testing
}
and switch to "custom"Additional context
Before and after: