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

don't pin new nodes to grid if not using grid

This commit is contained in:
Dave Conway-Jones 2019-01-21 16:15:38 +00:00
parent 766ccf85c2
commit 1d1ab5b7b2
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -703,8 +703,14 @@ RED.view = (function() {
} }
var nn = result.node; var nn = result.node;
var historyEvent = result.historyEvent; var historyEvent = result.historyEvent;
nn.x = Math.ceil((point[0] - 50) / gridSize) * gridSize + 50; if (RED.settings.get("editor").view['view-snap-grid']) {
nn.y = parseInt(point[1] / gridSize) * gridSize; nn.x = Math.ceil((point[0] - 50) / gridSize) * gridSize + 50;
nn.y = parseInt(point[1] / gridSize) * gridSize;
}
else {
nn.x = point[0];
nn.y = point[1];
}
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label"); var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) { if (showLabel !== undefined && !/^link (in|out)$/.test(nn._def.type) && !nn._def.defaults.hasOwnProperty("l")) {