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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user