feat(helper): export project function closes #237

This commit is contained in:
moklick
2020-05-19 18:33:29 +02:00
parent cebab6731b
commit c0390eec79
5 changed files with 28 additions and 5 deletions
+6
View File
@@ -74,6 +74,12 @@ export const pointToRendererPoint = (
return position;
};
export const project = (position: XYPosition): XYPosition => {
const { transform, snapToGrid, snapGrid } = store.getState();
return pointToRendererPoint(position, transform, snapToGrid, snapGrid);
};
export const parseElement = (element: Node | Edge): Node | Edge => {
if (!element.id) {
throw new Error('All elements (nodes and edges) need to have an id.');