removed old marker code

This commit is contained in:
jpellizzari
2017-03-13 09:03:50 -07:00
parent 376e6f014e
commit 9b648834ee
3 changed files with 0 additions and 58 deletions

View File

@@ -1,18 +0,0 @@
import React from 'react';
export default function Marker({id, offset, size, children, viewBox}) {
return (
<marker
className="edge-marker"
id={id}
viewBox={viewBox}
refX={offset}
refY="3.5"
markerWidth={size}
markerHeight={size}
orient="auto"
>
{children}
</marker>
);
}

View File

@@ -2,7 +2,6 @@ import { fromJS } from 'immutable';
import {
initEdgesFromNodes,
collapseMultiEdges,
} from '../layouter-utils';
@@ -22,20 +21,4 @@ describe('LayouterUtils', () => {
});
});
});
describe('collapseMultiEdges', () => {
it('should return collapsed multi-edges', () => {
const input = fromJS({
'a-b': { id: 'a-b', source: 'a', target: 'b' },
'a-c': { id: 'a-c', source: 'a', target: 'c' },
'b-a': { id: 'b-a', source: 'b', target: 'a' },
'b-b': { id: 'b-b', source: 'b', target: 'b' },
});
expect(collapseMultiEdges(input).toJS()).toEqual({
'a-b': { id: 'a-b', source: 'a', target: 'b', bidirectional: true },
'a-c': { id: 'a-c', source: 'a', target: 'c' },
'b-b': { id: 'b-b', source: 'b', target: 'b' },
});
});
});
});

View File

@@ -30,26 +30,3 @@ export function initEdgesFromNodes(nodes) {
return edges;
}
// Replaces all pairs of edges (A->B, B->A) with a single A->B edge that is marked as
// bidirectional. We do this to prevent double rendering of edges between the same nodes.
export function collapseMultiEdges(directedEdges) {
let collapsedEdges = makeMap();
directedEdges.forEach((edge, edgeId) => {
const source = edge.get('source');
const target = edge.get('target');
const reversedEdgeId = constructEdgeId(target, source);
if (collapsedEdges.has(reversedEdgeId)) {
// If the edge between the same nodes with the opposite direction already exists,
// mark it as bidirectional and don't add any other edges (making graph simple).
collapsedEdges = collapsedEdges.setIn([reversedEdgeId, 'bidirectional'], true);
} else {
// Otherwise just copy the edge.
collapsedEdges = collapsedEdges.set(edgeId, edge);
}
});
return collapsedEdges;
}