Description
Describe the project you are working on
Game Project
Describe the problem or limitation you are having in your project
Whenever I use Control
nodes that need to clip their content, I find that I only ever really mean to clip the content in either the vertical axis
or the horizontal axis
. For example, when I create a scrollable list of items, I only need the list to be clipped in the vertical axis: any part of the list that is above or below the rect needs to be clipped. However, parts of the content that are extruding the left or right of the content do not need to be clipped.
This is something I frequently run into while making iterations to our UI. Small additions need to be made, and for visual appearance or spacing reasons, I designed them to extrude the core rect. Whenever I translate my designs into Godot, I find that it simply isn't possible, due to the rect being too small and cutting off my additions.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I want the rect_clip_content
to be split into 2 (or 4: each direction rather than each axis) separate booleans. rect_clip_vertical
and rect_clip_horizontal
. That way, I can make sure that vertical scrollable control nodes only ever clip the areas that I want to have clipped.
the way I would like to have the clipped control behave
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If rect_clip_vertical
is true
, only content above the top red line, and below the bottom red line should be clipped. If rect_clip_horizontal
is true
, only content to the left of the left green line, and to the right of the right green line should be clipped.
If both are true
, any content outside the rect
should be clipped, as it works now.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I'm not sure how often other developers run into this, but during the development of our game I have ran into this numerous times already.
This issue can actually be worked around, but it generally requires a lot of premeditated Control node setup. With multiple MarginContainers
the core rect can be made bigger than it seems, meaning there is additional space on the left & right, in which nodes can extrude without being clipped. Getting this to work within the allowed space, and without impacting the visual spacing of your UI, can require quite a lot of fiddling.
Therefore, I still think that the requested feature would be a better, more consistent and easier to understand solution.
Is there a reason why this should be core and not an add-on in the asset library?
Core: Expands on Core components of Control Nodes