summaryrefslogtreecommitdiff
path: root/scene/gui/control.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-22 16:22:57 +0100
committerGitHub <noreply@github.com>2021-11-22 16:22:57 +0100
commit76aa1d0a433441e9bd863e1f489e9905c545f630 (patch)
treea5b299f1bd5bbeee6bf717ae5a02f28977f04af5 /scene/gui/control.cpp
parent8daf0cc49c4bab8dd039ced214e527b21708661e (diff)
parenteabf8f5edf6dc3346bd6a6e771e382f1a20a5c29 (diff)
Merge pull request #55151 from Chaosus/control_reset_size
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r--scene/gui/control.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index fdf10e2f42..9f715be155 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1825,6 +1825,10 @@ Size2 Control::get_size() const {
return data.size_cache;
}
+void Control::reset_size() {
+ set_size(Size2());
+}
+
Rect2 Control::get_global_rect() const {
return Rect2(get_global_position(), get_size());
}
@@ -2845,6 +2849,7 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_position", "position", "keep_offsets"), &Control::set_position, DEFVAL(false));
ClassDB::bind_method(D_METHOD("_set_position", "position"), &Control::_set_position);
ClassDB::bind_method(D_METHOD("set_size", "size", "keep_offsets"), &Control::set_size, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("reset_size"), &Control::reset_size);
ClassDB::bind_method(D_METHOD("_set_size", "size"), &Control::_set_size);
ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size);
ClassDB::bind_method(D_METHOD("set_global_position", "position", "keep_offsets"), &Control::set_global_position, DEFVAL(false));