-
Notifications
You must be signed in to change notification settings - Fork 567
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 baseline offset for sized widget #2110
base: master
Are you sure you want to change the base?
Conversation
Baseline offset is relative to the bottom of a widget. Current code assume that the widget has exactly the required height. For sized widgets, where there is more vertical space, the baseline is totally wrong. This patch series considers the additional space to adjust the baseline offset. Signed-off-by: Dietmar Maurer <[email protected]>
8fa6b5a
to
cbc607c
Compare
There are more widgets that needs to be fixed, i.e. TextBox. Attached an example to show the problem: |
Oh, I already added the TextBox fix. Just want to notice that I do
Why does the baseline depend on the viewport_rect? |
We use RawLabel:baseline_offset in Checkbox::layout, so this fixes wrong baseline with checkboxes. Signed-off-by: Dietmar Maurer <[email protected]>
Good question, I'm not sure (@cmyr?). I mean, if the |
this was a long time ago, but I believe this is just trying to figure out where in the overall widget the text is.
The
so what I think this is trying to do is to account for any possible scroll that is currently not visible, in order to adjust the baseline up to the bottom of the visible region. I am not sure it is right. Staring at it right now, I would expect it to be This is easy enough, though: if you have a textbox that can scroll vertically, and it is baseline aligned, do weird things happen to the layout when you scroll that textbox? |
I simply don't get why you want to account for any possible scroll that is currently not visible. Make no sense to me.
Yes. I have postend an example above where you can see the effects. |
Ah, I was reading it wrong, sorry. The baseline calculation doesn't depend on the scroll offset, just the height of the viewport. The effect of the current code is to put the baseline of the text box at the baseline of the first line of text, when the viewport is scrolled all the way to the top. I don't know if that's the desired behavior, but it's what it does. 2022-01-13.16-25-27.mp4 |
IMHO that behavior is really strange (Please compare with my patch applied) |
Baseline offset is relative to the bottom of a widget. Current code
assumes that the widget has exactly the required height. For sized
widgets, where there is more vertical space, the baseline is totally
wrong. This patch series considers the additional space to adjust the
baseline offset.
Signed-off-by: Dietmar Maurer [email protected]