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

Place subflow outputs/inputs relative to current view

Fixes #4111
This commit is contained in:
Nick O'Leary 2023-05-22 16:26:38 +01:00
parent b904c23e4d
commit 7a4f48e4fb
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 10 additions and 3 deletions

View File

@ -46,7 +46,9 @@ RED.subflow = (function() {
'</script>';
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) {
pos.x += 110;
}

View File

@ -4359,6 +4359,7 @@ RED.view = (function() {
this.__port__.setAttribute("transform","translate(-5,"+((d.h/2)-5)+")");
this.__outputOutput__.setAttribute("transform","translate(20,"+((d.h/2)-8)+")");
this.__outputNumber__.setAttribute("transform","translate(20,"+((d.h/2)+7)+")");
this.__outputNumber__.textContent = d.i+1;
}
d.dirty = false;
}
@ -6282,8 +6283,12 @@ RED.view = (function() {
})
},
scroll: function(x,y) {
if (x !== undefined && y !== undefined) {
chart.scrollLeft(chart.scrollLeft()+x);
chart.scrollTop(chart.scrollTop()+y)
} else {
return [chart.scrollLeft(), chart.scrollTop()]
}
},
clickNodeButton: function(n) {
if (n._def.button) {