1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Revert "Fix inspector jumping when gaining focus"

This reverts commit 9226424401.
This commit is contained in:
风青山
2025-02-26 16:26:03 +08:00
parent a375e77b85
commit d0437d5052
2 changed files with 4 additions and 12 deletions

View File

@@ -51,6 +51,7 @@
<members>
<member name="draw_focus_border" type="bool" setter="set_draw_focus_border" getter="get_draw_focus_border" overrides="ScrollContainer" default="true" />
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="2" />
<member name="follow_focus" type="bool" setter="set_follow_focus" getter="is_following_focus" overrides="ScrollContainer" default="true" />
<member name="horizontal_scroll_mode" type="int" setter="set_horizontal_scroll_mode" getter="get_horizontal_scroll_mode" overrides="ScrollContainer" enum="ScrollContainer.ScrollMode" default="0" />
</members>
<signals>

View File

@@ -3046,7 +3046,6 @@ void EditorInspector::update_tree() {
int current_focusable = -1;
// Temporarily disable focus following on the root inspector to avoid jumping while the inspector is updating.
bool was_following = get_root_inspector()->is_following_focus();
get_root_inspector()->set_follow_focus(false);
if (property_focusable != -1) {
@@ -3075,7 +3074,7 @@ void EditorInspector::update_tree() {
_clear(!object);
if (!object) {
get_root_inspector()->set_follow_focus(was_following);
get_root_inspector()->set_follow_focus(true);
return;
}
@@ -3954,7 +3953,7 @@ void EditorInspector::update_tree() {
EditorNode::get_singleton()->hide_unused_editors();
}
get_root_inspector()->set_follow_focus(was_following);
get_root_inspector()->set_follow_focus(true);
}
void EditorInspector::update_property(const String &p_prop) {
@@ -4807,15 +4806,6 @@ void EditorInspector::_notification(int p_what) {
update_tree();
}
} break;
case NOTIFICATION_FOCUS_ENTER: {
set_follow_focus(true);
} break;
case NOTIFICATION_FOCUS_EXIT: {
// Don't follow focus when the inspector is not focused. Prevents potential jumping when gaining focus.
set_follow_focus(false);
} break;
}
}
@@ -4972,6 +4962,7 @@ EditorInspector::EditorInspector() {
base_vbox->add_child(main_vbox);
set_horizontal_scroll_mode(SCROLL_MODE_DISABLED);
set_follow_focus(true);
changing = 0;
search_box = nullptr;