diff --git a/editor/js/history.js b/editor/js/history.js index 2443109ad..5c822045b 100644 --- a/editor/js/history.js +++ b/editor/js/history.js @@ -80,6 +80,12 @@ RED.history = (function() { } } } + if (ev.removedLinks) { + for (i=0;i"; RED.sidebar.info.set(help); }); + var chart = $("#chart"); + var chartOffset = chart.offset(); + var chartSVG = $("#chart>svg").get(0); + var activeSpliceLink; + var mouseX; + var mouseY; + var spliceTimer; $(d).draggable({ helper: 'clone', appendTo: 'body', @@ -220,6 +227,56 @@ RED.palette = (function() { // TODO: this is the margin-left of palette node. Hard coding // it here makes me sad ui.position.left += 17.5; + if (def.inputs > 0 && def.outputs > 0) { + mouseX = e.clientX - chartOffset.left+chart.scrollLeft(); + mouseY = e.clientY-chartOffset.top +chart.scrollTop(); + + if (!spliceTimer) { + spliceTimer = setTimeout(function() { + + var svgRect = chartSVG.createSVGRect(); + svgRect.x = mouseX; + svgRect.y = mouseY; + svgRect.width = 1; + svgRect.height = 1; + var bestDistance = Infinity; + var bestLink = null; + var nodes = chartSVG.getIntersectionList(svgRect,chartSVG); + mouseX /= RED.view.scale(); + mouseY /= RED.view.scale(); + for (var i=0;i .link_line { + stroke-dasharray: 15,8; +} g.link_selected path.link_line { stroke: $node-selected-color;