MCPcopy Create free account
hub / github.com/Zleap-AI/SAG / buildCircularPositionMap

Function buildCircularPositionMap

web/src/components/ProjectGraphFlow.tsx:482–515  ·  view source on GitHub ↗
(graph: ProjectGraphRecord)

Source from the content-addressed store, hash-verified

480}
481
482function 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
517function fallbackPosition(): GraphPosition {
518 return {

Callers 1

ProjectGraphCanvasFunction · 0.85

Calls 2

placeOnRingsFunction · 0.85
placeEventsOnOuterRingsFunction · 0.85

Tested by

no test coverage detected