From 43e1b879d02c53e2b4ef87fa6a42678dddca29b3 Mon Sep 17 00:00:00 2001 From: Franklin Sobrinho Date: Sat, 28 Nov 2015 13:05:39 -0300 Subject: [PATCH] Add container automatic update when moving a child node --- scene/gui/container.cpp | 8 ++++++++ scene/gui/container.h | 1 + 2 files changed, 9 insertions(+) diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index 6c74bc39777..8cdf4dd0393 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -52,6 +52,14 @@ void Container::add_child_notify(Node *p_child) { } +void Container::move_child_notify(Node *p_child) { + + if (!p_child->cast_to()) + return; + + queue_sort(); +} + void Container::remove_child_notify(Node *p_child) { diff --git a/scene/gui/container.h b/scene/gui/container.h index ba9bf2d60fc..04d5d6ab365 100644 --- a/scene/gui/container.h +++ b/scene/gui/container.h @@ -42,6 +42,7 @@ protected: void queue_sort(); virtual void add_child_notify(Node *p_child); + virtual void move_child_notify(Node *p_child); virtual void remove_child_notify(Node *p_child); void _notification(int p_what);