소스 검색

Fix GraphNode immediately losing focus

Closes: #30243

GraphNode immediately loses focus, and gives focus to its parent.

This fix changes implementation so that it does not transfer focus to its parent after receiving focus. Instead, it will transfer focus when the "close button" is pressed.
Emmanuel Barroga 6 년 전
부모
커밋
381faf83c3
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      scene/gui/graph_node.cpp

+ 2 - 2
scene/gui/graph_node.cpp

@@ -599,6 +599,8 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
 
 			Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y);
 			if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
+				//send focus to parent
+				get_parent_control()->grab_focus();
 				emit_signal("close_request");
 				accept_event();
 				return;
@@ -615,9 +617,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
 				return;
 			}
 
-			//send focus to parent
 			emit_signal("raise_request");
-			get_parent_control()->grab_focus();
 		}
 
 		if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {