-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: clamp title and hint size to min 20% width #668
feat: clamp title and hint size to min 20% width #668
Conversation
87197de
to
aeba34a
Compare
aeba34a
to
904cc02
Compare
I've tried doing a non linear interpolation together with that minimum size thing, and it adds a bunch of complexity to the calculation while also being susceptible to text with inaccuracies. It also has to account for the possibility that due to the non linearity one part actually gets much more space then it actually needs and so that then requires a clamp with the text width. Overall it wasn't easy to get right, or rather I though it wasn't right due to the text width inaccuracy and took a bunch of debugging to make sure it's actually correct, and the benefit over a simple linear interpolation with clamping is barely noticeable. Maybe with 100% accurate text widths it would be a worthwhile improvement, but as things stand I actually prefer the results of clamped linear interpolation. In case this ever becomes relevant in the future, I took half of a 2 wide Hann function and transformed it from |
How about doing something like: If the delta in width between title and hint is less than 30% of the total width they require (they're around same lengths), we use the current linear cutoff. If it's bigger, we let the shorter one decide the cutoff so that its text is never clipped. Because the longer the text is, the less of an issue it is to clip something out of it. For example in the inputs menu, I wouldn't mind not seeing the whole command, I can already infer what it does from the visible part, but I would mind getting the shortcut clipped. Also there should be some spacing between title and hint clips. |
32f7811
to
5a8f141
Compare
I really don't want long texts to cause clipping of really short ones. If text is long, it has a lot of noise and therefore is a prime candidate for clipping. If it's short, it's dense with information, and shouldn't be clipped. So we need to find some ideal conditions to trigger this mode. Lets say the text can't be clipped, and all clipping happens on the other one if it's:
If neither satisfies this, we just use linear clipping we have now. |
I'd rather not set a hard limit like 120 pixels, and instead make it relative to menu width or something. I've now changed it to a 50% cap, so each one can only use more then that if the other one doesn't need it. There has got to be a smarter way of writing the same thing, but I can't think of anything... |
bc46a7c
to
e088dde
Compare
Yeah I really like this solution 👍. |
Doesn't yet have any of the non-linear stuff, but it's already a big improvement.
ref #665 (comment)
For comparison with the screenshot in the comment: