From e7dccf04d27a8b5b6a53fddf26ebd3aada3d0624 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 7 Nov 2014 11:22:00 +0000 Subject: [PATCH] Changing subflow in/outs leaving wires behind Fixes #477 --- public/red/ui/editor.js | 4 ++-- public/red/ui/view.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/red/ui/editor.js b/public/red/ui/editor.js index d41bd2a9a..aba578b76 100644 --- a/public/red/ui/editor.js +++ b/public/red/ui/editor.js @@ -750,8 +750,8 @@ RED.editor = (function() { var wasDirty = RED.view.dirty(); var newName = $("#subflow-input-name").val(); - var newInCount = $("#subflow-input-inCount").val(); - var newOutCount = $("#subflow-input-outCount").val(); + var newInCount = Number($("#subflow-input-inCount").val())||0; + var newOutCount = Number($("#subflow-input-outCount").val())||0; var oldInCount = editing_node.in.length; var oldOutCount = editing_node.out.length; diff --git a/public/red/ui/view.js b/public/red/ui/view.js index e56cbbed1..c261c939e 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -2016,20 +2016,22 @@ RED.view = (function() { type:"subflow", id:subflowId, name:name, - in: candidateInputs.map(function(v,i) { return { + in: candidateInputs.map(function(v,i) { var index = i; return { type:"subflow", direction:"in", x:v.target.x-(v.target.w/2)-80, y:v.target.y, z:subflowId, + i:index, wires:[{id:v.target.id}] }}), - out: candidateOutputs.map(function(v) { return { + out: candidateOutputs.map(function(v,i) { var index = i; return { type:"subflow", direction:"in", x:v.source.x+(v.source.w/2)+80, y:v.source.y, z:subflowId, + i:index, wires:[{id:v.source.id,port:v.sourcePort}] }}) };