diff --git a/editor/js/nodes.js b/editor/js/nodes.js index 07245222b..e2f9780d4 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -195,9 +195,6 @@ RED.nodes = (function() { } nodes.push(n); } - if (n._def.onadd) { - n._def.onadd.call(n); - } } function addLink(l) { links.push(l); diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 64ee10e05..8f37d5d3a 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -2208,6 +2208,14 @@ RED.view = (function() { node.n.y -= minY; node.dx -= minX; node.dy -= minY; + if (node.n._def.onadd) { + try { + node.n._def.onadd.call(node.n); + } catch(err) { + console.log("onadd:",err); + } + } + } if (!touchImport) { mouse_mode = RED.state.IMPORT_DRAGGING; @@ -2218,7 +2226,6 @@ RED.view = (function() { node.n._def.outputs > 0; } } - RED.keyboard.add("*",/* ESCAPE */ 27,function(){ RED.keyboard.remove(/* ESCAPE */ 27); clearSelection(); diff --git a/nodes/core/core/60-link.html b/nodes/core/core/60-link.html index 4963645ba..3b72385b9 100644 --- a/nodes/core/core/60-link.html +++ b/nodes/core/core/60-link.html @@ -236,16 +236,12 @@ i = n.links.indexOf(node.id); if (i > -1) { n.links.splice(i,1); - n.changed = true; - n.dirty = true; } } else if (!nodeMap[id].old && nodeMap[id].new){ // Added id i = n.links.indexOf(id); if (i === -1) { n.links.push(node.id); - n.changed = true; - n.dirty = true; } } } @@ -253,6 +249,15 @@ } } + function onAdd() { + for (var i=0;i