ScrollContainer's max scroll_vertical is larger than expected

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Diet Estus

I have a ScrollContainer which contains a VBoxContainer of Buttons.


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.

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?
Oh it actually there. Are you who open the issue?
And someone already fix this. Well I hope it will merged soon.

earlroxas | 2018-08-29 02:07

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

Diet Estus | 2018-08-29 03:07