center node control relative to mouse position

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lalel345
func _on_TextureRect_gui_input(event):
	if Input.is_action_pressed("left"):
		rect_position = get_global_mouse_position()

when I do this the node does go down to the bottom right corner with respect to the mouse pointer
How do I center it? If I change the rect_offset to half it still does not work

:bust_in_silhouette: Reply From: timothybrentwood
 rect_position = get_global_mouse_position() + (rect_size / 2.0)