feat(rfInstance): add getElements function #274

This commit is contained in:
moklick
2020-06-02 16:06:08 +02:00
parent 02bcd1be11
commit 3f3a79b5f6
5 changed files with 26 additions and 2 deletions
+14
View File
@@ -210,3 +210,17 @@ const zoom = (amount: number): void => {
export const zoomIn = (): void => zoom(0.2);
export const zoomOut = (): void => zoom(-0.2);
export const getElements = (): Elements => {
const { nodes, edges } = store.getState();
return [
...nodes.map((node) => {
const n = { ...node };
delete n.__rg;
return n;
}),
...edges.map((e) => ({ ...e })),
];
};