From 0a1851032bda46b53ec11f4da8b6f7f75c7f9c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=92=E5=B1=B1?= Date: Sat, 29 Mar 2025 12:40:26 +0800 Subject: [PATCH] Use the correct root inspector when making elements moved in an array visible --- editor/editor_properties_array_dict.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index b4c7871037..f8f2112036 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -897,8 +897,12 @@ void EditorPropertyArray::_reorder_button_gui_input(const Ref &p_eve // Automatically move to the next/previous page. _page_changed(page_index + direction); } - // Ensure the moving element is visible. - InspectorDock::get_inspector_singleton()->ensure_control_visible(reorder_slot.container); + // Ensure the moving element is visible in the root inspector. + EditorInspector *parent_inspector = get_parent_inspector(); + if (parent_inspector) { + // Defer to prevent moving elements from not displaying properly, especially near borders. + callable_mp((ScrollContainer *)parent_inspector->get_root_inspector(), &ScrollContainer::ensure_control_visible).call_deferred(reorder_slot.container); + } } } }