1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

TabContainer Fix moving dropped tab at incorrect child index

(cherry picked from commit a5a4532378)
This commit is contained in:
kleonc
2021-08-02 14:15:51 +02:00
committed by Rémi Verschelde
parent 54084ac70d
commit 17fcd76a74

View File

@@ -745,7 +745,7 @@ void TabContainer::drop_data(const Point2 &p_point, const Variant &p_data) {
if (from_path == to_path) { if (from_path == to_path) {
if (hover_now < 0) if (hover_now < 0)
hover_now = get_tab_count() - 1; hover_now = get_tab_count() - 1;
move_child(get_tab_control(tab_from_id), hover_now); move_child(get_tab_control(tab_from_id), get_tab_control(hover_now)->get_index());
set_current_tab(hover_now); set_current_tab(hover_now);
} else if (get_tabs_rearrange_group() != -1) { } else if (get_tabs_rearrange_group() != -1) {
// drag and drop between TabContainers // drag and drop between TabContainers
@@ -757,7 +757,7 @@ void TabContainer::drop_data(const Point2 &p_point, const Variant &p_data) {
add_child(moving_tabc); add_child(moving_tabc);
if (hover_now < 0) if (hover_now < 0)
hover_now = get_tab_count() - 1; hover_now = get_tab_count() - 1;
move_child(moving_tabc, hover_now); move_child(moving_tabc, get_tab_control(hover_now)->get_index());
set_current_tab(hover_now); set_current_tab(hover_now);
emit_signal("tab_changed", hover_now); emit_signal("tab_changed", hover_now);
} }