diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-07-27 14:24:04 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-07-27 14:24:18 +0300 |
commit | c9966db8a14f590958b58750872aa14234113b06 (patch) | |
tree | f588cbabed1d8821538714b398f9afe3cece0473 /scene/3d | |
parent | 1bb56d92980c268a24d826a342ed4c44e7058b5a (diff) |
Fix Label3D not updated on window resize.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/label_3d.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp index bc435c5451..8a0d3576f2 100644 --- a/scene/3d/label_3d.cpp +++ b/scene/3d/label_3d.cpp @@ -31,6 +31,7 @@ #include "label_3d.h" #include "core/core_string_names.h" +#include "scene/main/viewport.h" #include "scene/resources/theme.h" #include "scene/scene_string_names.h" @@ -174,6 +175,14 @@ void Label3D::_notification(int p_what) { if (!pending_update) { _im_update(); } + Viewport *viewport = get_viewport(); + ERR_FAIL_COND(!viewport); + viewport->connect("size_changed", callable_mp(this, &Label3D::_font_changed)); + } break; + case NOTIFICATION_EXIT_TREE: { + Viewport *viewport = get_viewport(); + ERR_FAIL_COND(!viewport); + viewport->disconnect("size_changed", callable_mp(this, &Label3D::_font_changed)); } break; case NOTIFICATION_TRANSLATION_CHANGED: { String new_text = tr(text); |