Skip to content

Commit

Permalink
refactor(utils): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Oct 4, 2019
1 parent 04252b3 commit 0bd2102
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/graph-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ export const parseElement = (e, transform) => {
};
};

export const separateElements = (res, element) => {
res.edges = res.edges ? res.edges : [];
res.nodes = res.nodes ? res.nodes : [];

if (isEdge(element)) {
res.edges.push(element);
} else {
res.nodes.push(element);
}

return res;
};

export const getBoundingBox = (nodes) => {
const bbox = nodes.reduce((res, node) => {
const { position } = node.__rg;
Expand Down Expand Up @@ -142,7 +129,7 @@ export const getNodesInside = (nodes, bbox, transform = [0, 0, 1], partially = f

export const getConnectedEdges = (nodes, edges) => {
const nodeIds = nodes.map(n => n.id);
return edges.filter(e => nodeIds.includes(e.source) || nodeIds.includes(e.target))
return edges.filter(e => nodeIds.includes(e.source) || nodeIds.includes(e.target));
};

export const fitView = ({ padding = 0 } = {}) => {
Expand Down Expand Up @@ -170,7 +157,6 @@ export const zoomOut = () => {

export default {
isEdge,
separateElements,
getBoundingBox,
graphPosToZoomedPos,
getConnectedEdges,
Expand Down

0 comments on commit 0bd2102

Please sign in to comment.