I think, though I have not tested the code below, something like this should work:
var mouse_pos = get_local_mouse_position()
# check if the length of the vector is over 400
if mouse_pos.length() > 400:
# Normalize the vector to set the length to 1, while still retaining the
# position relative to the center
var normalized_mouse_pos = mouse_pos.normalized()
# multiply by 400 so it's 400 pixels away from the center
var mouse_pos = normalized_mouse_pos * 400
# Finally, set the position of the sprite
$Sprite.position = mouse_pos
I think that should work. I did something similar for the touchscreen joystick tutorial I made, and it seemed to work decently. Let me know if that does not work and I'll make a quick prototype.