+1 vote

I have a ScrollContainer which contains a VBoxContainer of Buttons.

ScrollContainer
    VBoxContainer
       Button1
       Button2
       Button3

The VBoxContainer has a custom separation of 0, so that there are no spaces between the buttons.

The ScrollContainer has scroll_vertical_enabled = true and scroll_horiztonal_enabled = false.

The Buttons are each 20 px tall and the ScrollContainer is 40 px tall.

I currently have a custom script which looks for key presses and changes which Button is focused and alters the scroll_vertical of the ScrollContainer in the event that the focused Button is not visible in the ScrollContainer. The exact code isn't important, since the problem is independent of it.

I noticed that no matter what I do, the maximum value of scroll_vertical is always 12 px more than expected.

With three Buttons each 20 px tall, you'd expect the maximum scroll_vertical to be (3 - 1) * 20 = 40 px, but is actually 52 px. With ten Buttons, you'd expect the maximum to be (10 - 1) * 20 = 180 px, but it is actually 192 px.

The result of this is that whenever I scroll down to the last Button in my VBoxContainer, there is an ugly gap at the bottom of the VScrollBar, corresponding to the 12 extra pixels.

enter image description here

What's the deal? How can I get rid of these pixels?

I suspect that maybe these 12 extra pixels correspond to the height of an HScrollBar that isn't visible but is somehow figuring into the mix.

in Engine by (1,530 points)
edited by

I have same issue, I hope someone answer this question.
I also tried to fix this but no luck.
Maybe we should report this as bug in github?
[Edit]
Oh it actually there. Are you who open the issue?
And someone already fix this. Well I hope it will merged soon.

earlroxas, yes, I opened the issue and am happy it was fixed so quickly!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories