How to use the @projectstorm/react-diagrams.PortModelAlignment.LEFT 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-custom-node1 / index.tsx View on Github external
		.registerFactory(new SimplePortFactory('diamond', config => new DiamondPortModel(PortModelAlignment.LEFT)));
	engine.getNodeFactories().registerFactory(new DiamondNodeFactory());
github projectstorm / react-diagrams / packages / diagrams-demo-gallery / demos / demo-custom-node1 / index.tsx View on Github external
//3-A) create a default node
	var node1 = new DefaultNodeModel('Node 1', 'rgb(0,192,255)');
	var port1 = node1.addOutPort('Out');
	node1.setPosition(100, 200);

	//3-B) create our new custom node
	var node2 = new DiamondNodeModel();
	node2.setPosition(250, 108);

	var node3 = new DefaultNodeModel('Node 3', 'red');
	var port3 = node3.addInPort('In');
	node3.setPosition(500, 100);

	//3-C) link the 2 nodes together
	var link1 = port1.link(node2.getPort(PortModelAlignment.LEFT));
	var link2 = port3.link(node2.getPort(PortModelAlignment.RIGHT));

	var node4 = new DefaultNodeModel('Node 4', 'rgb(0,192,255)');
	var port4 = node4.addOutPort('Out');
	node4.setPosition(200, 10);

	var link3 = port4.link(node2.getPort(PortModelAlignment.TOP));

	var node5 = new DefaultNodeModel('Node 5', 'mediumpurple');
	var port5 = node5.addInPort('In');
	node5.setPosition(400, 300);

	var link4 = port5.link(node2.getPort(PortModelAlignment.BOTTOM));

	//4) add the models to the root graph
	model.addAll(node1, node2, node3, link1, link2, node4, link3, link4, node5);