Skip to content

Commit

Permalink
WIP: create offset
Browse files Browse the repository at this point in the history
  • Loading branch information
grtlr committed Nov 15, 2024
1 parent 2e54352 commit 0ccef12
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions examples/rust/node_link/src/examples/binary_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ pub fn run(args: &Args) -> anyhow::Result<()> {
("6", ("6", (0.0 * s, 0.0 * s))),
("5_0", ("5", (-20.0 * s, 30.0 * s))),
("9_0", ("9", (20.0 * s, 30.0 * s))),
// ("6", ("6", (-10.0 * s, 60.0 * s))),
// ("5_0", ("5", (-20.0 * s, 90.0 * s))),
// ("11", ("11", (0.0 * s, 90.0 * s))),
// ("9_0", ("9", (20.0 * s, 30.0 * s))),
// ("9_1", ("9", (30.0 * s, 60.0 * s))),
// ("5_1", ("5", (20.0 * s, 90.0 * s))),
]
.into_iter()
.collect();
Expand Down Expand Up @@ -111,6 +105,8 @@ pub fn run(args: &Args) -> anyhow::Result<()> {
}
}

let entity_offset_x = 400.0;

for level in levels_sorted {
if !level.nodes.is_empty() {
t += 1;
Expand All @@ -119,7 +115,10 @@ pub fn run(args: &Args) -> anyhow::Result<()> {
"sorted",
&GraphNodes::new(level.nodes.iter().copied())
.with_labels(level.nodes.iter().map(|n| nodes_sorted[n].0))
.with_positions(level.nodes.iter().map(|n| nodes_sorted[n].1)),
.with_positions(level.nodes.iter().map(|n| {
let (x, y) = nodes_sorted[n].1;
[x + entity_offset_x, y]
})),
);
}

Expand Down

0 comments on commit 0ccef12

Please sign in to comment.