|
|
@@ -243,10 +243,10 @@ Draw.loadPlugin(function(ui) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function closestBorder(cell, parentGeometry) {
|
|
|
+ function closestBorder(cellGeometry, parentGeometry) {
|
|
|
// Coordinates are relative to topleft corner of parent shape
|
|
|
- const {x,y, width, height} = cell.geometry;
|
|
|
- // Center of dragged shape
|
|
|
+ const {x,y, width, height} = cellGeometry;
|
|
|
+ // Center of cell
|
|
|
const cX = x + width/2;
|
|
|
const cY = y + height/2;
|
|
|
|
|
|
@@ -299,7 +299,7 @@ Draw.loadPlugin(function(ui) {
|
|
|
for (const cell of cells) {
|
|
|
const parentGeometry = getPortParentGeometry(cell);
|
|
|
if (parentGeometry) {
|
|
|
- const border = closestBorder(cell, parentGeometry);
|
|
|
+ const border = closestBorder(cell.geometry, parentGeometry);
|
|
|
moveToBorder(cell.geometry, parentGeometry, border);
|
|
|
}
|
|
|
}
|
|
|
@@ -330,7 +330,8 @@ Draw.loadPlugin(function(ui) {
|
|
|
|
|
|
for (const cell of parent.children) {
|
|
|
const parentGeometry = getPortParentGeometry(cell);
|
|
|
- const border = closestBorder(cell, oldParentGeometry);
|
|
|
+ if (!parentGeometry) continue;
|
|
|
+ const border = closestBorder(cell.geometry, oldParentGeometry);
|
|
|
const newGeometry = cell.geometry.clone();
|
|
|
moveToBorder(newGeometry, parentGeometry, border);
|
|
|
|