(graph: ProjectGraphRecord)
| 480 | } |
| 481 | |
| 482 | function buildCircularPositionMap(graph: ProjectGraphRecord) { |
| 483 | const positions = new Map<string, GraphPosition>(); |
| 484 | const entities = [...graph.entities].sort(compareEntities); |
| 485 | const [rootEntity, ...secondaryEntities] = entities; |
| 486 | |
| 487 | if (rootEntity) { |
| 488 | positions.set(rootEntity.id, { |
| 489 | x: -ENTITY_NODE_WIDTH / 2, |
| 490 | y: -NODE_HEIGHT / 2, |
| 491 | angle: -Math.PI / 2, |
| 492 | radius: 0, |
| 493 | root: true |
| 494 | }); |
| 495 | } |
| 496 | |
| 497 | placeOnRings({ |
| 498 | ids: secondaryEntities.map((entity) => entity.id), |
| 499 | positions, |
| 500 | startRadius: ENTITY_RING_START_RADIUS, |
| 501 | ringGap: ENTITY_RING_GAP, |
| 502 | slotSpacing: ENTITY_SLOT_SPACING, |
| 503 | nodeWidth: ENTITY_NODE_WIDTH, |
| 504 | nodeHeight: NODE_HEIGHT, |
| 505 | angleOffset: -Math.PI / 2 |
| 506 | }); |
| 507 | |
| 508 | placeEventsOnOuterRings({ |
| 509 | events: graph.events, |
| 510 | positions, |
| 511 | angleOffset: EVENT_ANGLE_OFFSET |
| 512 | }); |
| 513 | |
| 514 | return positions; |
| 515 | } |
| 516 | |
| 517 | function fallbackPosition(): GraphPosition { |
| 518 | return { |
no test coverage detected