Originally found the solution in jabcross's answer above.
Adding a few more details for anyone else going down this rabbithole.
"Clip Content" is found here in the Inspector Dock :
Control -> Rect -> Clip Content
Rect is present in all nodes derived from Control
(which is derived from CanvasItem & Node)
Enabling clip content will make any portion of child nodes outside of the parent rect invisible.
This clip content setting can also be enabled in gdscript.
Add a script.gd to any Control derived node, and type
rect_clip_content = true
Hints for those starting out :
Do this in
_ready(): and it will immediately take effect.
But unless you need to change this setting during gameplay, go ahead and just set it in the Inspector Dock. It's good to know how to do things in scripts, but prefer the Inspector when a setting will remain the same.
You do not need to type var, this variable is already present in your script as soon as you derive Control. The variable
rect_clip_content is is a class property (aka class variable) that is present in any .gd script which derives Control or any of its descendants.
(If this is new information, it's good to know that when you type
extends somenodename, you automatically have access in your .gd script to the extended node's methods & class properties. And also to all methods and properties from each node it inherits -> all the way up to the class Object.)
Word of caution : this clip rect setting only affects what is visible in the viewport.
Input events will still fire for any child nodes that are wholly or partially invisible due to the rect clipping of a parent node.
You need to do the following to clip input:
If you want to prevent hidden portions of nodes from triggering
_input(event) calls or
_gui_input(event) calls, add this function to the parent which is clipping content :
I was recently making a picture viewer, and though parts were hidden they were still triggering input events when I thought nothing was under the cursor.
This page keeps coming up in my google searches for clipping,
so wanted to add some details.
Have a great day.