Make the theme editor correctly stop updating after it was hidden

This commit is contained in:
Yuri Sizov 2021-12-29 23:34:31 +03:00
parent 4e4dead41a
commit b32acc57f3

View file

@ -36,6 +36,8 @@
#include "editor/editor_scale.h"
constexpr double REFRESH_TIMER = 1.5;
void ThemeEditorPreview::set_preview_theme(const Ref<Theme> &p_theme) {
preview_content->set_theme(p_theme);
}
@ -66,7 +68,7 @@ void ThemeEditorPreview::_refresh_interval() {
}
void ThemeEditorPreview::_preview_visibility_changed() {
set_process(is_visible());
set_process(is_visible_in_tree());
}
void ThemeEditorPreview::_picker_button_cbk() {
@ -192,7 +194,7 @@ void ThemeEditorPreview::_notification(int p_what) {
case NOTIFICATION_PROCESS: {
time_left -= get_process_delta_time();
if (time_left < 0) {
time_left = 1.5;
time_left = REFRESH_TIMER;
_refresh_interval();
}
} break;