mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
place node dragged from palette within workspace
This commit is contained in:
parent
62cd3b2061
commit
c4332658ba
@ -526,6 +526,23 @@ RED.view = (function() {
|
|||||||
nn.x = mousePos[0];
|
nn.x = mousePos[0];
|
||||||
nn.y = mousePos[1];
|
nn.y = mousePos[1];
|
||||||
|
|
||||||
|
var minX = nn.w/2 -5;
|
||||||
|
if (nn.x < minX) {
|
||||||
|
nn.x = minX;
|
||||||
|
}
|
||||||
|
var minY = nn.h/2 -5;
|
||||||
|
if (nn.y < minY) {
|
||||||
|
nn.y = minY;
|
||||||
|
}
|
||||||
|
var maxX = space_width -nn.w/2 +5;
|
||||||
|
if (nn.x > maxX) {
|
||||||
|
nn.x = maxX;
|
||||||
|
}
|
||||||
|
var maxY = space_height -nn.h +5;
|
||||||
|
if (nn.y > maxY) {
|
||||||
|
nn.y = maxY;
|
||||||
|
}
|
||||||
|
|
||||||
if (snapGrid) {
|
if (snapGrid) {
|
||||||
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
|
var gridOffset = RED.view.tools.calculateGridSnapOffsets(nn);
|
||||||
nn.x -= gridOffset.x;
|
nn.x -= gridOffset.x;
|
||||||
|
Loading…
Reference in New Issue
Block a user