mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge pull request #4147 from kazuhitoyokoi/master-selection2subflow
Add node width and height to boundingBox
This commit is contained in:
		@@ -663,24 +663,23 @@ RED.subflow = (function() {
 | 
			
		||||
        var candidateOutputs = [];
 | 
			
		||||
        var candidateInputNodes = {};
 | 
			
		||||
 | 
			
		||||
        var boundingBox = [nodeList[0].x,
 | 
			
		||||
            nodeList[0].y,
 | 
			
		||||
            nodeList[0].x,
 | 
			
		||||
            nodeList[0].y];
 | 
			
		||||
        var boundingBox = [nodeList[0].x-(nodeList[0].w/2),
 | 
			
		||||
            nodeList[0].y-(nodeList[0].h/2),
 | 
			
		||||
            nodeList[0].x+(nodeList[0].w/2),
 | 
			
		||||
            nodeList[0].y+(nodeList[0].h/2)];
 | 
			
		||||
 | 
			
		||||
        for (i=0;i<nodeList.length;i++) {
 | 
			
		||||
            n = nodeList[i];
 | 
			
		||||
            nodes[n.id] = {n:n,outputs:{}};
 | 
			
		||||
            boundingBox = [
 | 
			
		||||
                Math.min(boundingBox[0],n.x),
 | 
			
		||||
                Math.min(boundingBox[1],n.y),
 | 
			
		||||
                Math.max(boundingBox[2],n.x),
 | 
			
		||||
                Math.max(boundingBox[3],n.y)
 | 
			
		||||
                Math.min(boundingBox[0],n.x-(n.w/2)),
 | 
			
		||||
                Math.min(boundingBox[1],n.y-(n.h/2)),
 | 
			
		||||
                Math.max(boundingBox[2],n.x+(n.w/2)),
 | 
			
		||||
                Math.max(boundingBox[3],n.y+(n.h/2))
 | 
			
		||||
            ]
 | 
			
		||||
        }
 | 
			
		||||
        var offsetX = snapToGrid(boundingBox[0] - 200);
 | 
			
		||||
        var offsetY = snapToGrid(boundingBox[1] - 80);
 | 
			
		||||
 | 
			
		||||
        var offsetX = snapToGrid(boundingBox[0] - 140);
 | 
			
		||||
        var offsetY = snapToGrid(boundingBox[1] - 60);
 | 
			
		||||
 | 
			
		||||
        var center = [
 | 
			
		||||
            snapToGrid((boundingBox[2]+boundingBox[0]) / 2),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user