Remember Customization Open/Closed State per Session Only

This commit is contained in:
GreenComfyTea
2023-08-18 13:00:00 +03:00
parent a33b196521
commit 475cd22610
3 changed files with 11 additions and 13 deletions

View File

@@ -505,9 +505,7 @@ end
-- #region -- #region
re.on_draw_ui(function() re.on_draw_ui(function()
if imgui.button(language.current_language.customization_menu.mod_name .. " v" .. config.current_config.version) then if imgui.button(language.current_language.customization_menu.mod_name .. " v" .. config.current_config.version) then
local cached_config = config.current_config.customization_menu; customization_menu.is_opened = not customization_menu.is_opened;
cached_config.visible = not cached_config.visible;
config.save_current();
end end
end); end);
@@ -542,9 +540,9 @@ end);
-- #endregion -- #endregion
-----------------------Loop Callbacks------------------------ -----------------------Loop Callbacks------------------------
time.init_global_timers();
time.new_timer(update_UI, 0.5);
if imgui.begin_table == nil then if imgui.begin_table == nil then
re.msg(language.current_language.customization_menu.reframework_outdated); re.msg(language.current_language.customization_menu.reframework_outdated);
end end
time.init_global_timers();
time.new_timer(update_UI, 0.5);

View File

@@ -7973,8 +7973,6 @@ function this.init_default()
}, },
customization_menu = { customization_menu = {
visible = false,
position = { position = {
x = 360, x = 360,
y = 50 y = 50

View File

@@ -64,6 +64,8 @@ local os = os;
local ValueType = ValueType; local ValueType = ValueType;
local package = package; local package = package;
this.is_opened = false;
this.font = nil; this.font = nil;
this.full_font_range = {0x1, 0xFFFF, 0}; this.full_font_range = {0x1, 0xFFFF, 0};
@@ -326,7 +328,7 @@ function this.init()
end end
function this.draw() function this.draw()
if not config.current_config.customization_menu.visible then if not this.is_opened then
return; return;
end end
@@ -339,13 +341,13 @@ function this.draw()
imgui.push_font(this.font); imgui.push_font(this.font);
config.current_config.customization_menu.visible = imgui.begin_window( this.is_opened = imgui.begin_window(
string.format("%s v%s", language.current_language.customization_menu.mod_name, config.current_config.version), string.format("%s v%s", language.current_language.customization_menu.mod_name, config.current_config.version),
config.current_config.customization_menu.visible, this.is_opened,
this.window_flags); this.window_flags);
if not config.current_config.customization_menu.visible then if not this.is_opened then
imgui.pop_font(); imgui.pop_font();
imgui.end_window(); imgui.end_window();
config.save_current(); config.save_current();