MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readLayout

Function readLayout

graph-ui/src/layout/layout-model.ts:224–255  ·  view source on GitHub ↗
(store: LayoutStore | undefined, project: string, frame: LayoutFrame)

Source from the content-addressed store, hash-verified

222 * einer Zahl aus einer anderen Fassung sieht aus wie ein Layoutfehler.
223 */
224export function readLayout(store: LayoutStore | undefined, project: string, frame: LayoutFrame): LayoutSizes {
225 if (store === undefined) {
226 return defaultLayout(frame);
227 }
228 let raw: string | null = null;
229 try {
230 raw = store.getItem(layoutStorageKey(project));
231 } catch {
232 return defaultLayout(frame);
233 }
234 if (raw === null || raw.length === 0) {
235 return defaultLayout(frame);
236 }
237 let parsed: unknown;
238 try {
239 parsed = JSON.parse(raw);
240 } catch {
241 return defaultLayout(frame);
242 }
243 if (parsed === null || typeof parsed !== 'object') {
244 return defaultLayout(frame);
245 }
246 const record = parsed as Partial<Record<LayoutKey, unknown>>;
247 const sizes = { ...LAYOUT_DEFAULT };
248 for (const key of LAYOUT_KEYS) {
249 const value = record[key];
250 if (typeof value === 'number' && Number.isFinite(value)) {
251 sizes[key] = value;
252 }
253 }
254 return clampLayout(sizes, frame);
255}
256
257/** Die vier Zahlen merken. Ein Speicher, der nicht will, wird nicht erzwungen. */
258export function writeLayout(store: LayoutStore | undefined, project: string, sizes: LayoutSizes): void {

Callers 2

ProjectWindowViewFunction · 0.90

Calls 4

defaultLayoutFunction · 0.85
layoutStorageKeyFunction · 0.85
clampLayoutFunction · 0.85
getItemMethod · 0.65

Tested by

no test coverage detected