properly center editor view and make zoom follow mouse position

This commit is contained in:
Crispy 2024-10-07 21:21:37 +02:00
parent 355a5af15e
commit 82d0ff0f37
3 changed files with 40 additions and 9 deletions

View file

@ -213,7 +213,9 @@ impl Game {
d.draw_text(solution.id(), column_x, y + 35, 10, Color::GRAY);
if simple_button(d, column_x, y + 50, 220, 30) {
self.open_editor = Some(Editor::new(solution.clone(), level.clone()));
let mut editor = Editor::new(solution.clone(), level.clone());
editor.center_view(d);
self.open_editor = Some(editor);
}
d.draw_text("edit", column_x + 5, y + 55, 20, Color::WHITE);
}