fix(nodes): don't project position when adding a new node #220

This commit is contained in:
moklick
2020-05-14 14:36:28 +02:00
parent a0ddfd8693
commit 1922c37155
2 changed files with 12 additions and 19 deletions
+2 -4
View File
@@ -19,9 +19,7 @@ const useElementUpdater = (elements: Elements): void => {
useEffect(() => {
const nodes = elements.filter(isNode) as Node[];
const edges = elements
.filter(isEdge)
.map((e) => parseElement(e, state.transform, state.snapToGrid, state.snapGrid)) as Edge[];
const edges = elements.filter(isEdge).map((e) => parseElement(e)) as Edge[];
const nextNodes = nodes.map((propNode) => {
const existingNode = state.nodes.find((n) => n.id === propNode.id);
@@ -58,7 +56,7 @@ const useElementUpdater = (elements: Elements): void => {
};
}
return parseElement(propNode, state.transform, state.snapToGrid, state.snapGrid);
return parseElement(propNode);
}) as Node[];
const nodesChanged: boolean = !isEqual(state.nodes, nextNodes);