-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathy-pre-exit.fixture.ts
More file actions
77 lines (70 loc) · 1.7 KB
/
y-pre-exit.fixture.ts
File metadata and controls
77 lines (70 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type { SerializedHyperGraph } from "@tscircuit/hypergraph"
const REGION_SIZE = 1.6
const gridPoint = (x: number, y: number) => ({ x: x * 2, y: y * 2 })
const createRegion = (
regionId: string,
x: number,
y: number,
pointIds: string[],
): NonNullable<SerializedHyperGraph["regions"]>[number] => ({
regionId,
pointIds,
d: {
center: gridPoint(x, y),
width: REGION_SIZE,
height: REGION_SIZE,
},
})
const createPort = (
portId: string,
region1Id: string,
region2Id: string,
x: number,
y: number,
z = 0,
): NonNullable<SerializedHyperGraph["ports"]>[number] => ({
portId,
region1Id,
region2Id,
d: {
...gridPoint(x, y),
z,
},
})
const routeA = {
connectionId: "route-a",
startRegionId: "start-a",
endRegionId: "end-a",
mutuallyConnectedNetworkId: "net-0",
}
const routeB = {
connectionId: "route-b",
startRegionId: "start-b",
endRegionId: "end-b",
mutuallyConnectedNetworkId: "net-0",
}
export const yPreExitFixture: SerializedHyperGraph = {
regions: [
createRegion("start-a", 0, 2, ["a-port"]),
createRegion("start-b", 0, 0, ["b-port"]),
createRegion("center-y", 1, 1, ["a-port", "b-port", "shared-port"]),
createRegion("shared-parent", 2, 1, ["shared-port", "end-port"]),
createRegion("same-end", 3, 1, ["end-port"]),
],
ports: [
createPort("a-port", "start-a", "center-y", 0.5, 1.75),
createPort("b-port", "start-b", "center-y", 0.5, 0.25),
createPort("shared-port", "center-y", "shared-parent", 1.5, 1),
createPort("end-port", "shared-parent", "same-end", 2.5, 1),
],
connections: [
{
...routeA,
endRegionId: "same-end",
},
{
...routeB,
endRegionId: "same-end",
},
],
}