summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp8
-rw-r--r--scene/gui/control.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 64d1d38abb..7daeb6eab6 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -186,6 +186,14 @@ Size2 Control::_edit_get_minimum_size() const {
}
#endif
+void Control::reparent(Node *p_parent, bool p_keep_global_transform) {
+ Transform2D temp = get_global_transform();
+ Node::reparent(p_parent);
+ if (p_keep_global_transform) {
+ set_global_position(temp.get_origin());
+ }
+}
+
// Editor integration.
void Control::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 288de7c9e7..a11f7da00f 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -387,6 +387,7 @@ public:
virtual Size2 _edit_get_minimum_size() const override;
#endif
+ virtual void reparent(Node *p_parent, bool p_keep_global_transform = true) override;
// Editor integration.