refactor(nodes): always render nodes that are dragged closes #477

This commit is contained in:
moklick
2020-09-11 17:12:09 +02:00
parent d17e6ebaea
commit 8a0a928e17
6 changed files with 33 additions and 21 deletions
+3 -2
View File
@@ -126,6 +126,7 @@ export const parseElement = (element: Node | Edge): Node | Edge => {
width: null,
height: null,
handleBounds: {},
isDragging: false,
},
} as Node;
};
@@ -182,13 +183,13 @@ export const getNodesInside = (
height: rect.height / tScale,
});
return nodes.filter(({ __rf: { position, width, height } }) => {
return nodes.filter(({ __rf: { position, width, height, isDragging } }) => {
const nBox = rectToBox({ ...position, width, height });
const xOverlap = Math.max(0, Math.min(rBox.x2, nBox.x2) - Math.max(rBox.x, nBox.x));
const yOverlap = Math.max(0, Math.min(rBox.y2, nBox.y2) - Math.max(rBox.y, nBox.y));
const overlappingArea = xOverlap * yOverlap;
if (width === null || height === null) {
if (width === null || height === null || isDragging) {
// at the beginnning all nodes have width & height === 0
return true;
}