mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add arrow-heads to links
This commit is contained in:
parent
50cb074172
commit
5e9ff98c49
@ -835,8 +835,9 @@ RED.view = (function() {
|
|||||||
} else {
|
} else {
|
||||||
scale = 0.4-0.2*(Math.max(0,(node_width-Math.min(Math.abs(dx),Math.abs(dy)))/node_width));
|
scale = 0.4-0.2*(Math.max(0,(node_width-Math.min(Math.abs(dx),Math.abs(dy)))/node_width));
|
||||||
}
|
}
|
||||||
|
var result;
|
||||||
if (dx*sc > 0) {
|
if (dx*sc > 0) {
|
||||||
return "M "+origX+" "+origY+
|
result = "M "+origX+" "+origY+
|
||||||
" C "+(origX+sc*(node_width*scale))+" "+(origY+scaleY*node_height)+" "+
|
" C "+(origX+sc*(node_width*scale))+" "+(origY+scaleY*node_height)+" "+
|
||||||
(destX-sc*(scale)*node_width)+" "+(destY-scaleY*node_height)+" "+
|
(destX-sc*(scale)*node_width)+" "+(destY-scaleY*node_height)+" "+
|
||||||
destX+" "+destY
|
destX+" "+destY
|
||||||
@ -877,7 +878,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
cp[2][0] = topX;
|
cp[2][0] = topX;
|
||||||
}
|
}
|
||||||
return "M "+origX+" "+origY+
|
result = "M "+origX+" "+origY+
|
||||||
" C "+
|
" C "+
|
||||||
cp[0][0]+" "+cp[0][1]+" "+
|
cp[0][0]+" "+cp[0][1]+" "+
|
||||||
cp[1][0]+" "+cp[1][1]+" "+
|
cp[1][0]+" "+cp[1][1]+" "+
|
||||||
@ -892,6 +893,7 @@ RED.view = (function() {
|
|||||||
cp[4][0]+" "+cp[4][1]+" "+
|
cp[4][0]+" "+cp[4][1]+" "+
|
||||||
destX+" "+destY
|
destX+" "+destY
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNode(type,x,y) {
|
function addNode(type,x,y) {
|
||||||
@ -4605,18 +4607,14 @@ RED.view = (function() {
|
|||||||
d.y1 = d.source.y+y;
|
d.y1 = d.source.y+y;
|
||||||
d.x2 = d.target.x-d.target.w/2;
|
d.x2 = d.target.x-d.target.w/2;
|
||||||
d.y2 = d.target.y;
|
d.y2 = d.target.y;
|
||||||
|
var targetOffset = d.link?16:11
|
||||||
// return "M "+d.x1+" "+d.y1+
|
var path = generateLinkPath(d.x1+5,d.y1,d.x2-targetOffset,d.y2,1);
|
||||||
// " C "+(d.x1+scale*node_width)+" "+(d.y1+scaleY*node_height)+" "+
|
|
||||||
// (d.x2-scale*node_width)+" "+(d.y2-scaleY*node_height)+" "+
|
|
||||||
// d.x2+" "+d.y2;
|
|
||||||
var path = generateLinkPath(d.x1,d.y1,d.x2,d.y2,1);
|
|
||||||
if (/NaN/.test(path)) {
|
if (/NaN/.test(path)) {
|
||||||
path = ""
|
path = ""
|
||||||
}
|
}
|
||||||
this.__pathBack__.setAttribute("d",path);
|
this.__pathBack__.setAttribute("d",path);
|
||||||
this.__pathOutline__.setAttribute("d",path);
|
this.__pathOutline__.setAttribute("d",path);
|
||||||
this.__pathLine__.setAttribute("d",path);
|
this.__pathLine__.setAttribute("d",path + "m0 0, l 0 -2 l 3 2 l -3 2 z");
|
||||||
this.__pathLine__.classList.toggle("red-ui-flow-node-disabled",!!(d.source.d || d.target.d));
|
this.__pathLine__.classList.toggle("red-ui-flow-node-disabled",!!(d.source.d || d.target.d));
|
||||||
this.__pathLine__.classList.toggle("red-ui-flow-subflow-link", !d.link && activeSubflow);
|
this.__pathLine__.classList.toggle("red-ui-flow-subflow-link", !d.link && activeSubflow);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user