Closed nodeSpace closed 2 years ago
I just started using this library and this was the first thing I wanted :+1:
Two nits:
The example needs updating, just changing self.state.draw_graph_editor(ctx, AllMyNodeTemplates)
to
let graph_response =
egui::CentralPanel::default().show(&ctx, |ui| {
self.state.draw_graph_editor(ctx, ui, AllMyNodeTemplates)
}).inner;
and maybe rewording the comment two lines up
It seems like nodes are being drawn relative to the screen instead of the UI, i.e. using the code below, the nodes in the window don't move with the window when it is moved (but I haven't checked the code to confirm why this is happening)
egui::Window::new(&editor.title).show(ctx, |ui| {
editor.graph.draw_graph_editor(ctx, ui, AllNodeTemplates);
});
(I mistakenly wrote this comment before editing. I don't care. Don't mind.)
I think gmorenz's idea and this modification are excellent.
Also, the ctx
argument may not be necessary since ctx
can be gotten by ui.ctx()
.
I cleared up the merge conflicts and apply some suggestions from this thread. Merging this, thank you all for the great work! :smile:
I also tried to make the example spawn the grap inside a window to showcase the new feature, but this uncovered a couple of QoL issues documented in #27.
Proposal to fix #4 Note, this would be a breaking change and will require users to pass in an
&ui
when calling thedraw_graph_editor()