diff --git a/src/stores/useModelStore.ts b/src/stores/useModelStore.ts index 00cbfbf..48f3b8d 100644 --- a/src/stores/useModelStore.ts +++ b/src/stores/useModelStore.ts @@ -47,6 +47,30 @@ function savePlacement(fileName: string, fineTuning: FineTuning) { } catch {} } +// ── Visibility (selection-based hide/isolate) persistence ──────────── +const VISIBILITY_KEY = 'tsxr_visibility_v1'; +interface StoredVisibility { hidden: string[]; isolated: string[] | null; } +function loadVisibilityMap(): Record { + try { + const raw = localStorage.getItem(VISIBILITY_KEY); + if (raw) return JSON.parse(raw); + } catch {} + return {}; +} +function saveVisibility(fileName: string, hidden: Set, isolated: Set | null) { + try { + const all = loadVisibilityMap(); + all[fileName] = { hidden: [...hidden], isolated: isolated ? [...isolated] : null }; + localStorage.setItem(VISIBILITY_KEY, JSON.stringify(all)); + } catch {} +} +function loadVisibility(fileName: string): { hidden: Set; isolated: Set | null } { + const v = loadVisibilityMap()[fileName]; + if (!v) return { hidden: new Set(), isolated: null }; + return { hidden: new Set(v.hidden ?? []), isolated: v.isolated ? new Set(v.isolated) : null }; +} + + export interface ScaleRatio { label: string; // e.g. "1:50", "2:1", "1:1"