-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
Add SizeContainer
#112364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add SizeContainer
#112364
Conversation
|
The icon SVG currently is a simple copy of |
4fefff8 to
398d516
Compare
|
Can this new node enable the |
|
So how is it better than #94171? |
Because that is giving ScrollContainer the responsibility of limiting size, and necessitates a workaround - making invisible scrollbars - to achieve the same effect.
It should. If it doesn't, then there's an implementation issue. WIll try it, and fix if it doesn't work. |
4706ca5 to
5afa427
Compare
|
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 Edit: maybe this could be used for autowrap with Labels, will investigate |
5afa427 to
2d0ac66
Compare
|
@KoBeWi I saw your comment on the proposal, godotengine/godot-proposals#13534 (comment). Discussing here since it is implementation-level, not feature discussion. Could you please give more details on what you are suggesting for the implementation, so that we can discuss it, and I can maybe work towards migrating the implementation to it? The current |
|
It would be like #94171 and godotengine/godot-proposals#13568, except instead of an exposed property in the relevant node, the max size would be set by SizeContainer. That means Control would get |
|
How would that be any better than the Sidenote: The way #94171 was implemented wouldn't have worked for what this PR is trying to accomplish. It would only be a limit on the |
|
That's weird, I have that exact same setup (well a VBox instead of HBox) and it works with the latest version of the PR. Does your size container have a Edit: It shouldn't matter, I checked the code (I don't have access to my machine which has the binary at the moment), and |
|
I'm using the latest version and I do have maximum size set. Can you share your scene? |
|
Sure, here's my file https://drive.google.com/file/d/1wign3IAbZnfNcwUqaYeuQMVXofzEbmgo/view?usp=drive_link Edit: please send yours, so I can compare both on my device and make it work for you scenario - provided it is proper use of the Container |
|
I found the difference. My ScrollContainer had |
|
Well, that's definitely unintended behavior. I'll take a look at why it's happening. Edit: I had it disabled because getting the horizontal scrollbar was annoying me, which thinking about it, it shouldn't have showed up in the first place :/ |
2d0ac66 to
ef6b2d1
Compare
ef6b2d1 to
c847845
Compare
b2294d7 to
6b71c8c
Compare
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. Adapt `ScrollContainer` to work with new `custom_maximum_size`
Adds a `SizeContainer` node, which supports modifying the Control `custom_maximum_size` property. 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
6b71c8c to
92985f5
Compare
|
Revamped implementation: This now uses a This now supports I've split it into two commits because the changes in both are significant enough to warrant separate commits.
|


custom_maximum_sizetoControlgodot-proposals#13534ScrollContainer.max_size#94171Control::_update_minimum_size()not updating offsets #112525 (Noted such that if that PR causes any issues, the fix to said issues gets ported here)Adds a
custom_maximum_sizeinternal property toControl. Themaximum_sizewill serve as a cap on the container's size.The
custom_maximum_sizeis aSize2, and will apply dimension-wise if that dimension's value is greater than 0.custom_maximum_size= (100,0)will cap the width to 100 but will not cap the height~
Adds a
SizeContainerwhich exposes thecustom_maximum_sizeproperty. This container will also apply this property to all of its children Controls.If a child has the
Expandsize 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 overridden by using Custom anchoring, but that's A. beyond my control, B. an advanced-user thing -- use it at your own risk.
Additional feature:
ScrollContainerwith acustom_maximum_size(i.e. within aSizeContainer) will first expand as much as it can until it reaches the maximum size, and then will start showing scrollbars as needed.Future work:
custom_maximum_sizeinLabelasautowrap_width, implementing Addautowrap_maximum_widthtoLabelandRichTextLabelgodot-proposals#13568