(model: StepsModel, selected: string)
| 1127 | * points alone; a picture without forks is just the selection. |
| 1128 | */ |
| 1129 | export function selectionReach(model: StepsModel, selected: string): ReadonlySet<string> { |
| 1130 | const reach = new Set([selected]); |
| 1131 | if (model.forks === null || model.forks.size === 0) return reach; |
| 1132 | for (let grew = true; grew; ) { |
| 1133 | grew = false; |
| 1134 | for (const e of model.layout.edges) { |
| 1135 | const from = reach.has(e.source); |
| 1136 | const to = reach.has(e.target); |
| 1137 | if (from === to) continue; |
| 1138 | const other = from ? e.target : e.source; |
| 1139 | if (model.forks.has(other) && !reach.has(other)) { |
| 1140 | reach.add(other); |
| 1141 | grew = true; |
| 1142 | } |
| 1143 | } |
| 1144 | } |
| 1145 | return reach; |
| 1146 | } |
| 1147 | |
| 1148 | /** |
| 1149 | * Which edges draw, given the selection. Selecting a step says "show me |
no test coverage detected