I want to create a popupmenu at the location of a mouse click, so I have something like:
func _input(event):
if event is InputEventMouseButton == false: return
if event.button_index != 1: return
if event.pressed: return
var popup = PopupMenu.new()
get_viewport().add_child(popup)
popup.rect_global_position = get_global_mouse_position()
popup.rect_size = Vector2(100, 100)
popup.popup()
The popup appears as expected when the mouse coordinates are at x > 0 and y > 0, however, when the mouse coordinates are x < 0 and y < 0, they get clamped to zero.
I found this answer which seems to have a similar issue, as well as this issue, however neither helped resolve the issue.
I feel like I am fundamentally misunderstanding something. Can you see what I am doing wrong?