Skip to content

Commit

Permalink
Create modules in center of visible viewport (Closes #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharph committed Sep 6, 2024
1 parent e0bdfa8 commit c1fe74b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ impl SynthModuleWorkspace {
.modules_pos
.get(&module.get_id())
.map(|(x, y)| pos2(*x, *y))
.unwrap_or(pos2(100.0, 100.0)),
.unwrap_or(
transform.inverse() * pos2((rect.width()) / 2.0, (rect.height()) / 2.0),
),
)
.order(egui::Order::Middle)
.show(ui.ctx(), |ui| {
Expand Down

0 comments on commit c1fe74b

Please sign in to comment.