Simplify plotter example

Use a callback that produces the plot from a pitch as the image source.
This commit is contained in:
Simon Hausmann 2021-08-11 17:05:07 +02:00
parent 8903adb584
commit 92655486da
2 changed files with 4 additions and 15 deletions

View file

@ -85,16 +85,7 @@ pub fn main() {
let main_window = MainWindow::new();
main_window.on_redraw({
let main_window_weak = main_window.as_weak();
move || {
let main_window = main_window_weak.upgrade().unwrap();
let plot = render_plot(main_window.get_pitch());
main_window.set_plot_image(plot);
}
});
main_window.invoke_redraw();
main_window.on_render_plot(render_plot);
main_window.run();
}