1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Activate link splice on node centre not mouse position

This commit is contained in:
Nick O'Leary 2016-04-17 21:28:56 +01:00
parent 95c31f3e17
commit 321f5e615b
2 changed files with 6 additions and 4 deletions

View File

@ -232,10 +232,12 @@ RED.palette = (function() {
drag: function(e,ui) { drag: function(e,ui) {
// TODO: this is the margin-left of palette node. Hard coding // TODO: this is the margin-left of palette node. Hard coding
// it here makes me sad // it here makes me sad
//console.log(ui.helper.position());
ui.position.left += 17.5; ui.position.left += 17.5;
if (def.inputs > 0 && def.outputs > 0) { if (def.inputs > 0 && def.outputs > 0) {
mouseX = e.clientX - chartOffset.left+chart.scrollLeft(); mouseX = ui.position.left+(ui.helper.width()/2) - chartOffset.left + chart.scrollLeft();
mouseY = e.clientY-chartOffset.top +chart.scrollTop(); mouseY = ui.position.top+(ui.helper.height()/2) - chartOffset.top + chart.scrollTop();
if (!spliceTimer) { if (!spliceTimer) {
spliceTimer = setTimeout(function() { spliceTimer = setTimeout(function() {

View File

@ -655,8 +655,8 @@ RED.view = (function() {
var nodes = []; var nodes = [];
var bestDistance = Infinity; var bestDistance = Infinity;
var bestLink = null; var bestLink = null;
var mouseX = mousePos[0]; var mouseX = node.n.x;
var mouseY = mousePos[1]; var mouseY = node.n.y;
if (outer[0][0].getIntersectionList) { if (outer[0][0].getIntersectionList) {
var svgRect = outer[0][0].createSVGRect(); var svgRect = outer[0][0].createSVGRect();
svgRect.x = mouseX; svgRect.x = mouseX;