Create node by dragging link into empty space (#1438)

* Create node by dragging into empty space

* Prevent add menu when disconnecting a link

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2023-10-24 13:22:41 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent b8906f344e
commit 6ff958d6ae
2 changed files with 100 additions and 57 deletions
+4 -2
View File
@@ -643,9 +643,11 @@ impl JsEditorHandle {
/// Creates a new document node in the node graph
#[wasm_bindgen(js_name = createNode)]
pub fn create_node(&self, node_type: String, x: i32, y: i32) {
let message = NodeGraphMessage::CreateNode { node_id: None, node_type, x, y };
pub fn create_node(&self, node_type: String, x: i32, y: i32) -> u64 {
let id = generate_uuid();
let message = NodeGraphMessage::CreateNode { node_id: Some(id), node_type, x, y };
self.dispatch(message);
id
}
/// Notifies the backend that the user selected a node in the node graph