feat: 导出设置支持展开/折叠(默认折叠)+ 恢复默认按钮

- 导出设置面板默认折叠,点击标题栏展开/收起,折叠栏显示当前分辨率摘要
- 折叠栏保留快速下载按钮,始终可用
- 新增🔄恢复默认按钮:一键重置分辨率/自定义/文件名/历史选择到初始状态(历史记录保留)
This commit is contained in:
2026-08-19 12:50:26 +08:00
parent 9a8cbb125c
commit 51d3e09378
3 changed files with 121 additions and 38 deletions
+26 -3
View File
@@ -648,6 +648,28 @@ function onExportPresetChange() {
refreshPreview();
}
// 导出设置面板展开/折叠(默认折叠)
let exportSettingsOpen = false;
function toggleExportSettings() {
exportSettingsOpen = !exportSettingsOpen;
const body = document.getElementById('exportSettingsBody');
const t = document.getElementById('exportToggle');
body.style.display = exportSettingsOpen ? 'block' : 'none';
t.textContent = exportSettingsOpen ? '▾' : '▸';
}
// 一键恢复默认(重置全部设置,历史记录保留)
function resetExportSettings() {
document.getElementById('exportPreset').value = 'original';
document.getElementById('customResGroup').style.display = 'none';
document.getElementById('customWidth').value = '';
document.getElementById('customHeight').value = '';
document.getElementById('exportFilename').value = '';
document.getElementById('exportHistory').value = '';
refreshExportHint();
refreshPreview();
}
function onCustomResInput() {
refreshExportHint();
refreshPreview();
@@ -778,12 +800,13 @@ function exportCurrent(prefix) {
}).catch(err => alert(err.message));
}
// 导出分辨率提示
// 导出分辨率提示 + 折叠栏摘要
function refreshExportHint() {
const { w, h } = getResolution();
const hint = document.getElementById('exportResHint');
if (!hint) return;
hint.textContent = w > 0 && h > 0 ? `导出分辨率:${w} × ${h}(原图居中缩放)` : '导出分辨率:原始大小';
if (hint) hint.textContent = w > 0 && h > 0 ? `导出分辨率:${w} × ${h}(原图居中缩放)` : '导出分辨率:原始大小';
const sum = document.getElementById('exportSummary');
if (sum) sum.textContent = w > 0 && h > 0 ? `${w} × ${h}` : '原始大小';
}
// 刷新导出预览:以原图为中心,居中展示保存后的图