How to use the @projectstorm/react-diagrams.RightAngleLinkFactory function in @projectstorm/react-diagrams

To help you get started, we’ve selected a few @projectstorm/react-diagrams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github projectstorm / react-diagrams / packages / diagrams-demo-gallery / demos / demo-right-angles-routing / index.tsx View on Github external
export default () => {
	// setup the diagram engine
	const engine = createEngine();
	engine.getLinkFactories().registerFactory(new RightAngleLinkFactory());

	// setup the diagram model
	const model = new DiagramModel();

	// create four nodes in a way that straight links wouldn't work
	const node1 = new DefaultNodeModel('Node A', 'rgb(0,192,255)');
	const port1 = node1.addPort(new RightAnglePortModel(false, 'out-1', 'Out'));
	node1.setPosition(340, 350);

	const node2 = new DefaultNodeModel('Node B', 'rgb(255,255,0)');
	const port2 = node2.addPort(new RightAnglePortModel(false, 'out-1', 'Out'));
	node2.setPosition(240, 80);
	const node3 = new DefaultNodeModel('Node C', 'rgb(192,255,255)');
	const port3 = node3.addPort(new RightAnglePortModel(true, 'in-1', 'In'));
	node3.setPosition(540, 180);
	const node4 = new DefaultNodeModel('Node D', 'rgb(192,0,255)');