Skip to content

Allow ScrollContainer's ScrollBar to always claim space #2121

Closed
godotengine/godot
#96871
@Arecher

Description

@Arecher

Describe the project you are working on

Attempting to use a ScrollContainer, to show it's limitations, in my opinion. As I said I would do in (#2119)

Describe the problem or limitation you are having in your project

The pop-in of the scrollbar, which rescales/moves content inside the scrollbar can be quite jarring. (This mostly happens whenever a scrollbar is used on a piece of UI that can be resized). I want to reserve a place for the scrollbar, so it doesn't need to adjust the content whenever it spawns. If the scrollbar isn't currently necessary, it will leave a blank space.

scrollcontainerpopin

The issue: Whenever the scrollbar pops in, the content is moved/rescaled. I show this in editor, because I was too lazy to make the panelcontainer resizable in-game, but it works the same.

Essentially, allow me to give the Scrollbar inside a ScrollContainer a rect_min_size.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

An additional setting for ScrollContainers, which allows the space required for the scrollbar to be shown is always claimed for the scrollbar.
This can either be a manual x,y input, or a boolean which automatically takes the minimum size that the scrollbar can be, and claims that.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Doing this with a custom built Scrollbar/ScrollContainer is very easy, as you can just set a rect_min_size and make the scrollbar invisible.

scrollcontainerpopincustom
The scrollbar on the right doesn't move the content of the "ScrollContainer". It is assigned its own space, which isn't taken by the content when the scrollbar becomes invisible

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not that I know of.

Is there a reason why this should be core and not an add-on in the asset library?

Core: Addition to functionality of ScrollContainers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions