mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 13:58:28 +00:00
Merge pull request #94 from kamirr/kek/dont_crash_on_removed_node
Allow inserting responses in draw_graph_editor
This commit is contained in:
commit
3068b8cd9b
@ -111,6 +111,7 @@ where
|
|||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
all_kinds: impl NodeTemplateIter<Item = NodeTemplate>,
|
all_kinds: impl NodeTemplateIter<Item = NodeTemplate>,
|
||||||
user_state: &mut UserState,
|
user_state: &mut UserState,
|
||||||
|
prepend_responses: Vec<NodeResponse<UserResponse, NodeData>>,
|
||||||
) -> GraphResponse<UserResponse, NodeData> {
|
) -> GraphResponse<UserResponse, NodeData> {
|
||||||
// This causes the graph editor to use as much free space as it can.
|
// This causes the graph editor to use as much free space as it can.
|
||||||
// (so for windows it will use up to the resizeably set limit
|
// (so for windows it will use up to the resizeably set limit
|
||||||
@ -130,7 +131,7 @@ where
|
|||||||
|
|
||||||
// The responses returned from node drawing have side effects that are best
|
// The responses returned from node drawing have side effects that are best
|
||||||
// executed at the end of this function.
|
// executed at the end of this function.
|
||||||
let mut delayed_responses: Vec<NodeResponse<UserResponse, NodeData>> = vec![];
|
let mut delayed_responses: Vec<NodeResponse<UserResponse, NodeData>> = prepend_responses;
|
||||||
|
|
||||||
// Used to detect when the background was clicked
|
// Used to detect when the background was clicked
|
||||||
let mut click_on_background = false;
|
let mut click_on_background = false;
|
||||||
|
|||||||
@ -417,8 +417,12 @@ impl eframe::App for NodeGraphExample {
|
|||||||
});
|
});
|
||||||
let graph_response = egui::CentralPanel::default()
|
let graph_response = egui::CentralPanel::default()
|
||||||
.show(ctx, |ui| {
|
.show(ctx, |ui| {
|
||||||
self.state
|
self.state.draw_graph_editor(
|
||||||
.draw_graph_editor(ui, AllMyNodeTemplates, &mut self.user_state)
|
ui,
|
||||||
|
AllMyNodeTemplates,
|
||||||
|
&mut self.user_state,
|
||||||
|
Vec::default(),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.inner;
|
.inner;
|
||||||
for node_response in graph_response.node_responses {
|
for node_response in graph_response.node_responses {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user