0 votes

I have a ScrollContainer with nodes in it. It scrolls fine, but when I reach the bottom of ScrollContainer, the scrolling stops. I would like it scroll up a bit longer, leaving a blank space at the bottom (like a margin).
I know how to do this using empty TextureRects or Labels, but I this it is a workaround. I think that add elements that will not be used is not a good solution.
Any ideas of how to add this space?

Godot version 3.2.3
in Engine by (38 points)

2 Answers

0 votes
Best answer

Add a MarginContainer inside the ScrollContainer, then put whatever was inside the ScrollContainer inside the MarginContainer. Under the MarginContainer's "Custom Constants" properties, set "Margin Bottom" to whatever value you desire.

by (4,484 points)
selected by

Sadly it have to be one more node to to this, but as that is the function of the MarginContainer, i think it is the best option. Solved my problem. Thant you.

0 votes

Found another solution when adding a theme today. It's a bit convoluted but doesn't require any extra nodes.

  1. Make a new theme for the ScrollContainer.
  2. Add a new ScrollContainer->Styles->Bg item to the theme.
  3. Add a new StyleBoxEmpty (or a different StyleBox if you want the ScrollContainer to have a background) to the previous item.
  4. Go to Content Margin and set "Bottom" to a positive value.
by (4,484 points)
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