mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Align centre of nodes in vertical flow view
This commit is contained in:
parent
fc590c66c0
commit
61f42f9efa
@ -1297,7 +1297,13 @@ RED.view = (function() {
|
||||
if (snapGrid != d3.event.shiftKey && moving_set.length > 0) {
|
||||
var gridOffset = [0,0];
|
||||
node = moving_set[0];
|
||||
gridOffset[0] = node.n.x-(gridSize*Math.floor((node.n.x-node.n.w/2)/gridSize)+node.n.w/2);
|
||||
if (vertical) {
|
||||
// Align to the centre point of the node
|
||||
gridOffset[0] = node.n.x-(gridSize*Math.floor(node.n.x/gridSize));
|
||||
} else {
|
||||
// Align to the left edge of the node
|
||||
gridOffset[0] = node.n.x-(gridSize*Math.floor((node.n.x-node.n.w/2)/gridSize)+node.n.w/2);
|
||||
}
|
||||
gridOffset[1] = node.n.y-(gridSize*Math.floor(node.n.y/gridSize));
|
||||
if (gridOffset[0] !== 0 || gridOffset[1] !== 0) {
|
||||
for (i = 0; i<moving_set.length; i++) {
|
||||
@ -3245,7 +3251,7 @@ RED.view = (function() {
|
||||
thisNode.selectAll(".red-ui-flow-node-changed")
|
||||
.attr("transform",function(d){return "translate("+(d.w-2)+", -2)"})
|
||||
.classed("hide",function(d) { return !(d.changed||d.moved); });
|
||||
|
||||
|
||||
thisNode.selectAll(".red-ui-flow-node-error")
|
||||
.attr("transform",function(d){ return "translate("+(d.w-2-((d.changed||d.moved)?14:0))+", -2)"})
|
||||
.classed("hide",function(d) { return d.valid; });
|
||||
@ -3253,7 +3259,7 @@ RED.view = (function() {
|
||||
thisNode.selectAll(".red-ui-flow-node-changed")
|
||||
.attr("transform",function(d){return "translate("+(d.w-10)+", -2)"})
|
||||
.classed("hide",function(d) { return !(d.changed||d.moved); });
|
||||
|
||||
|
||||
thisNode.selectAll(".red-ui-flow-node-error")
|
||||
.attr("transform",function(d){ return "translate("+(d.w-10-((d.changed||d.moved)?14:0))+", -2)"})
|
||||
.classed("hide",function(d) { return d.valid; });
|
||||
|
Loading…
Reference in New Issue
Block a user