Merge pull request #78996 from Tetane/create_shader_node_popup

Fix "Create Shader Node" window position when visual shader editor is floating
This commit is contained in:
Rémi Verschelde 2023-08-21 08:20:42 +02:00
commit 23db0240a2
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -3996,7 +3996,7 @@ void VisualShaderEditor::_show_members_dialog(bool at_mouse_pos, VisualShaderNod
members_dialog->popup();
// Keep dialog within window bounds.
Rect2 window_rect = Rect2(DisplayServer::get_singleton()->window_get_position(), DisplayServer::get_singleton()->window_get_size());
Rect2 window_rect = Rect2(get_window()->get_position(), get_window()->get_size());
Rect2 dialog_rect = Rect2(members_dialog->get_position(), members_dialog->get_size());
Vector2 difference = (dialog_rect.get_end() - window_rect.get_end()).max(Vector2());
members_dialog->set_position(members_dialog->get_position() - difference);