godot icon indicating copy to clipboard operation
godot copied to clipboard

Add horizontal and vertical separation to `ScrollContainer` theme constants.

Open WhalesState opened this issue 1 year ago • 7 comments

It's hard to make such separation in code, since the ScrollContainer doesn't provide signals to tell when the ScrollBar becomes visible or hidden, so this will save us from adding two extra dummy spacers which will also need an extra HBoxContainer and VBoxContainer and to show/hide the spacers when size is changed after checking if the HScrollBar or the VScrollBar is visible.

https://github.com/user-attachments/assets/ff2d9efa-575a-41ba-ac87-4722bacc720f

WhalesState avatar Sep 20 '24 18:09 WhalesState

100% safe.

The default is 0, for Compatibility 😄.

I also forgot to mention that it works fine for RTL layouts too.

image

Why?

Because we already can define a panel for ScrollContainer and we edit the content margin, it will look ugly if the scroll has a one side margin, but the other side can't be controlled.

image

WhalesState avatar Sep 20 '24 19:09 WhalesState

would v_scroll_bar_separation and h_scroll_bar_separation be better names?

Giganzo avatar Sep 21 '24 09:09 Giganzo

would v_scroll_bar_separation and h_scroll_bar_separation be better names?

Godot in general is using the words "separation", "h_separation" and "v_separation" for any similar kinds of separations.

For example button has "h_separation" not "h_text_separation" or "h_icon_separation".

Also this is easy to be achieved by binding a custom theme constant, but once it's merged and released, it will never be changed for compatibility.

WhalesState avatar Sep 21 '24 16:09 WhalesState

Godot in general is using the words "separation", "h_separation" and "v_separation" for any similar kinds of separations.

There is also Tree that has scrollbar_v_separation. And from the description it sounds like it does same as this pr but for the Tree

Giganzo avatar Sep 21 '24 17:09 Giganzo

I have no issues with it's name, let's just wait until someone reviews it, and we will resolve this.

WhalesState avatar Sep 21 '24 18:09 WhalesState

Needs rebase. There is new SCROLL_MODE_RESERVE that you need to take into account.

KoBeWi avatar Sep 21 '24 18:09 KoBeWi

Rebased.

WhalesState avatar Sep 21 '24 19:09 WhalesState

@Mickeon Probably another candidate for salvaging?

Zireael07 avatar Oct 26 '24 07:10 Zireael07

Yeah. But could use a proposal or general user interest first.

Mickeon avatar Oct 26 '24 08:10 Mickeon