diff options
author | jmb462 <jmb462@gmail.com> | 2021-08-31 17:43:35 +0200 |
---|---|---|
committer | RĂ©mi Verschelde <rverschelde@gmail.com> | 2021-12-06 14:29:48 +0100 |
commit | 81efebb3a170dd6194905599361c38ae4246c434 (patch) | |
tree | 0dc5df12b8df69c2272836bfbb66bbb30037a709 /modules/visual_script/editor | |
parent | ede7614fe2e088f9ece1e1aba5cb3d5fceb476e4 (diff) |
Fix bad popups offset in editor with single window off
Co-authored-by: Gil Arasa Verge <gilarasaverge@gmail.com>
Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
Diffstat (limited to 'modules/visual_script/editor')
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 13dd1f7bc7..349537521c 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -1506,7 +1506,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt } } else if (ti->get_parent() == root->get_first_child()) { selected = ti->get_text(0); - function_name_edit->set_position(Input::get_singleton()->get_mouse_position() - Vector2(60, -10)); + function_name_edit->set_position(get_screen_position() + get_local_mouse_position() - Vector2(60, -10)); function_name_edit->popup(); function_name_box->set_text(selected); function_name_box->select_all(); @@ -1974,7 +1974,7 @@ void VisualScriptEditor::input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> key = p_event; if (key.is_valid() && !key->is_pressed()) { - mouse_up_position = Input::get_singleton()->get_mouse_position(); + mouse_up_position = get_screen_position() + get_local_mouse_position(); } } @@ -1984,7 +1984,7 @@ void VisualScriptEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { if (key.is_valid() && key->is_pressed() && key->get_button_mask() == MouseButton::RIGHT) { saved_position = graph->get_local_mouse_position(); - Point2 gpos = Input::get_singleton()->get_mouse_position(); + Point2 gpos = get_screen_position() + get_local_mouse_position(); _generic_search(script->get_instance_base_type(), gpos); } } @@ -3704,7 +3704,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i Variant::construct(pinfo.type, existing, &existingp, 1, ce); } - default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_global_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y)); + default_value_edit->set_position(Object::cast_to<Control>(p_button)->get_screen_position() + Vector2(0, Object::cast_to<Control>(p_button)->get_size().y)); default_value_edit->reset_size(); if (pinfo.type == Variant::NODE_PATH) { @@ -4160,10 +4160,10 @@ void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { ERR_FAIL_COND(!ti); member_popup->clear(); - member_popup->set_position(members->get_global_position() + p_pos); + member_popup->set_position(members->get_screen_position() + p_pos); member_popup->reset_size(); - function_name_edit->set_position(members->get_global_position() + p_pos); + function_name_edit->set_position(members->get_screen_position() + p_pos); function_name_edit->reset_size(); TreeItem *root = members->get_root(); |