From 0741c6f422f07c44bb65ba727dfbd0a7586d118d Mon Sep 17 00:00:00 2001 From: Wx-2025 <351320169@qq.com> Date: Wed, 29 Oct 2025 21:47:40 +0800 Subject: [PATCH] Update state.js --- ui/state.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/ui/state.js b/ui/state.js index 6c1f0ec..71471a7 100644 --- a/ui/state.js +++ b/ui/state.js @@ -148,9 +148,37 @@ export function updateUI() { if (settings.historiographySmallTriggerThreshold !== undefined) { $('#amily2_mhb_small_trigger_count').val(settings.historiographySmallTriggerThreshold); } - populateModelDropdown(); - updatePlotOptimizationUI(); + // 同步渲染器开关状态 + if (settings.render_enabled !== undefined) { + $('#render-enable-toggle').prop('checked', settings.render_enabled); } + + // 同步渲染深度设置 + if (settings.render_depth !== undefined) { + $('#render-depth').val(settings.render_depth); + } + + populateModelDropdown(); + updatePlotOptimizationUI(); + + // Restore collapsible sections state + $('.collapsible').each(function() { + const section = $(this); + const legend = section.find('.collapsible-legend'); + const content = section.find('.collapsible-content'); + const icon = legend.find('.collapse-icon'); + const sectionId = legend.text().trim(); + const isCollapsed = extension_settings[extensionName][`collapsible_${sectionId}_collapsed`] ?? true; + + if (isCollapsed) { + content.hide(); + icon.removeClass('fa-chevron-up').addClass('fa-chevron-down'); + } else { + content.show(); + icon.removeClass('fa-chevron-down').addClass('fa-chevron-up'); + } + }); +} }