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

View File

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

View File

@@ -64,6 +64,8 @@ local os = os;
local ValueType = ValueType;
local package = package;
this.is_opened = false;
this.font = nil;
this.full_font_range = {0x1, 0xFFFF, 0};
@@ -326,7 +328,7 @@ function this.init()
end
function this.draw()
if not config.current_config.customization_menu.visible then
if not this.is_opened then
return;
end
@@ -339,13 +341,13 @@ function this.draw()
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),
config.current_config.customization_menu.visible,
this.is_opened,
this.window_flags);
if not config.current_config.customization_menu.visible then
if not this.is_opened then
imgui.pop_font();
imgui.end_window();
config.save_current();