Based on https://docs.godotengine.org/en/stable/tutorials/2d/custom_drawing_in_2d.html, I have created a few controls that have custom drawing. If I have a custom control on top of a built-in control, like a button, mouse cursor blocking works as expected, as long as the custom control's rect overlaps with the built-in control:
CustomControl script:
extends Control
func _process(delta):
queue_redraw()
func _draw():
if get_global_rect().has_point(get_global_mouse_position()):
draw_rect(get_global_rect(), Color.MAGENTA)
else:
draw_rect(get_global_rect(), Color.AQUA)
However, I would also like reverse: when a built-in node is on top of a custom drawn node, I want it to block.
This is what happens with the script I have (obviously I need to add something to it, or do something in order to actually have it block.):
Is there some property or variable I can access in the _draw function in the CustomControl's script so that I can know when it should be being blocked, or is there something else entirely that I should be doing? My goal is to be able to create control nodes with custom drawing that behave like the rest of the control nodes. Thanks.