changed from store.edges.update to store.edges.set

This commit is contained in:
peterkogo
2024-06-04 09:01:34 +02:00
parent 3cc14e8ee5
commit 7ebabacbe4

View File

@@ -202,6 +202,7 @@ export function createStore({
elements.forEach((element) => {
if (element.selected) {
element.selected = false;
console.log('reset');
elementsChanged = true;
}
});
@@ -210,10 +211,10 @@ export function createStore({
function unselectNodesAndEdges(params?: { nodes?: Node[]; edges?: Edge[] }) {
const resetNodes = resetSelectedElements(params?.nodes || get(store.nodes));
if (resetNodes) store.nodes.update((nds) => nds);
if (resetNodes) store.nodes.set(get(store.nodes));
const resetEdges = resetSelectedElements(params?.edges || get(store.edges));
if (resetEdges) store.edges.update((nds) => nds);
if (resetEdges) store.edges.set(get(store.edges));
}
store.deleteKeyPressed.subscribe(async (deleteKeyPressed) => {