mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #4183 from node-red/4111-subflow-node-position
Place subflow outputs/inputs relative to current view
This commit is contained in:
commit
0f5cf1d51c
@ -46,7 +46,9 @@ RED.subflow = (function() {
|
|||||||
'</script>';
|
'</script>';
|
||||||
|
|
||||||
function findAvailableSubflowIOPosition(subflow,isInput) {
|
function findAvailableSubflowIOPosition(subflow,isInput) {
|
||||||
var pos = {x:50,y:30};
|
const scrollPos = RED.view.scroll()
|
||||||
|
const scaleFactor = RED.view.scale()
|
||||||
|
var pos = { x: (scrollPos[0]/scaleFactor)+50, y: (scrollPos[1]/scaleFactor)+30 };
|
||||||
if (!isInput) {
|
if (!isInput) {
|
||||||
pos.x += 110;
|
pos.x += 110;
|
||||||
}
|
}
|
||||||
|
@ -4374,6 +4374,7 @@ RED.view = (function() {
|
|||||||
this.__port__.setAttribute("transform","translate(-5,"+((d.h/2)-5)+")");
|
this.__port__.setAttribute("transform","translate(-5,"+((d.h/2)-5)+")");
|
||||||
this.__outputOutput__.setAttribute("transform","translate(20,"+((d.h/2)-8)+")");
|
this.__outputOutput__.setAttribute("transform","translate(20,"+((d.h/2)-8)+")");
|
||||||
this.__outputNumber__.setAttribute("transform","translate(20,"+((d.h/2)+7)+")");
|
this.__outputNumber__.setAttribute("transform","translate(20,"+((d.h/2)+7)+")");
|
||||||
|
this.__outputNumber__.textContent = d.i+1;
|
||||||
}
|
}
|
||||||
d.dirty = false;
|
d.dirty = false;
|
||||||
}
|
}
|
||||||
@ -6296,8 +6297,12 @@ RED.view = (function() {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
scroll: function(x,y) {
|
scroll: function(x,y) {
|
||||||
|
if (x !== undefined && y !== undefined) {
|
||||||
chart.scrollLeft(chart.scrollLeft()+x);
|
chart.scrollLeft(chart.scrollLeft()+x);
|
||||||
chart.scrollTop(chart.scrollTop()+y)
|
chart.scrollTop(chart.scrollTop()+y)
|
||||||
|
} else {
|
||||||
|
return [chart.scrollLeft(), chart.scrollTop()]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
clickNodeButton: function(n) {
|
clickNodeButton: function(n) {
|
||||||
if (n._def.button) {
|
if (n._def.button) {
|
||||||
|
Loading…
Reference in New Issue
Block a user