(raw: unknown)
| 320 | * ist die einzige Zahl, ueber die dieses Modul etwas weiss. |
| 321 | */ |
| 322 | export function clampDisplaySettings(raw: unknown): GraphDisplaySettings { |
| 323 | const record = typeof raw === 'object' && raw !== null ? (raw as Record<string, unknown>) : {}; |
| 324 | return { |
| 325 | projection: asOneOf<GraphProjection>( |
| 326 | record['projection'], ['spatial', 'flat'], DEFAULT_GRAPH_DISPLAY.projection, |
| 327 | ), |
| 328 | halos: typeof record['halos'] === 'boolean' ? record['halos'] : DEFAULT_GRAPH_DISPLAY.halos, |
| 329 | bloom: typeof record['bloom'] === 'boolean' ? record['bloom'] : DEFAULT_GRAPH_DISPLAY.bloom, |
| 330 | edges: asOneOf<EdgeDensity>(record['edges'], ['full', 'dim', 'off'], DEFAULT_GRAPH_DISPLAY.edges), |
| 331 | labelDistanceFactor: asOneOf( |
| 332 | record['labelDistanceFactor'], LABEL_DISTANCE_FACTORS, DEFAULT_GRAPH_DISPLAY.labelDistanceFactor, |
| 333 | ), |
| 334 | frameCap: asOneOf(record['frameCap'], FRAME_CAPS, DEFAULT_GRAPH_DISPLAY.frameCap), |
| 335 | agents: typeof record['agents'] === 'boolean' |
| 336 | ? record['agents'] |
| 337 | : DEFAULT_GRAPH_DISPLAY.agents, |
| 338 | agentTails: typeof record['agentTails'] === 'boolean' |
| 339 | ? record['agentTails'] |
| 340 | : DEFAULT_GRAPH_DISPLAY.agentTails, |
| 341 | agentTrails: typeof record['agentTrails'] === 'boolean' |
| 342 | ? record['agentTrails'] |
| 343 | : DEFAULT_GRAPH_DISPLAY.agentTrails, |
| 344 | agentWaves: typeof record['agentWaves'] === 'boolean' |
| 345 | ? record['agentWaves'] |
| 346 | : DEFAULT_GRAPH_DISPLAY.agentWaves, |
| 347 | agentTimeline: typeof record['agentTimeline'] === 'boolean' |
| 348 | ? record['agentTimeline'] |
| 349 | : DEFAULT_GRAPH_DISPLAY.agentTimeline, |
| 350 | }; |
| 351 | } |
| 352 | |
| 353 | /** Praefix des Schluessels, unter dem die Wahl eines Projekts liegt. */ |
| 354 | export const DISPLAY_KEY_PREFIX = 'atlas-display:'; |
no test coverage detected