Skip to content

Conversation

@StarryWorm
Copy link
Contributor

@StarryWorm StarryWorm commented Nov 4, 2025

Adds a SizeContainer node, which supports a maximum_size property. The maximum_size will serve as a cap on the size of the container. All children of this container will be clipped to fit within that cap.

The maximum_size is a Size2, and will apply dimension-wise if that dimension's value is greater than 0.

  • e.g. maximum_size = (100,0) will cap the width to 100 but will not cap the height

If a child has Expand size flag, the container will expand to its maximum size in the specified axis.
Cannot have specific anchor flags, which would cause it to expand to be larger than its designated maximum size (namely all of the Wide types and the Full Rect). This can technically still be overriden by using Custom anchoring, but that's A. beyond my control, B. an advanced user thing - use it at your own risk.

@StarryWorm StarryWorm requested review from a team as code owners November 4, 2025 00:01
@StarryWorm
Copy link
Contributor Author

The icon SVG currently is a simple copy of MarginContainer's. I am not good at graphic design, and would like to request that whoever has handled this in the past please contribute an appropriate icon.
I don't know who that is, but ATS (or whichever other maintainer sees this), please cc the correct person for me, thanks!

@scgm0
Copy link
Contributor

scgm0 commented Nov 4, 2025

Can this new node enable the ScrollContainer to start scrolling when its size reaches max, otherwise, the ScrollContainer expands normally in size?

@KoBeWi
Copy link
Member

KoBeWi commented Nov 4, 2025

So how is it better than #94171?
You can set ScrollContainer's max size, make scrollbars invisible, and you will get effectively the same thing.

@StarryWorm
Copy link
Contributor Author

StarryWorm commented Nov 4, 2025

So how is it better than #94171?
You can set ScrollContainer's max size, make scrollbars invisible, and you will get effectively the same thing.

Because that is giving ScrollContainer the responsibility of limiting size, and necessitates a workaround - making invisible scrollbars - to achieve the same effect.
Just like every other subtype of Container does one thing, ScrollContainer should do its one thing, namely scrolling, and this SizeContainer would do its one thing, namely limiting size.

Can this new node enable the ScrollContainer to start scrolling when its size reaches max, otherwise, the ScrollContainer expands normally in size?

It should. If it doesn't, then there's an implementation issue. WIll try it, and fix if it doesn't work.

@StarryWorm StarryWorm force-pushed the SizeContainer branch 2 times, most recently from 4706ca5 to 5afa427 Compare November 4, 2025 18:16
@StarryWorm
Copy link
Contributor Author

StarryWorm commented Nov 4, 2025

Added support for ScrollContainer. This required a bit more of an involved change since there was no existing way to get the "maximum size" a Control could fill. I put it as the get_combined_minimum_size() by default and then provided a specific override for ScrollContainer. I don't think any of the other Control types need/support something like that but I might be wrong.

Edit: maybe this could be used for autowrap with Labels, will investigate

Adds a `SizeContainer` node, which supports a `maximum_size` property.
The `maximum_size` will serve as a cap on the size of the container. All children of this container will be clipped to fit within that cap.
If a child has expand size flag, the container will expand to its maximum size in the specified axis
Cannot have specific anchor flags which would cause it to expand to be larger than its designated maximum size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a SizeContainer control node

4 participants