thanks for the code - however I can't seem to get this working on my system - the `endPoint` property is always undefined
when running the sample, all I get is the following:
I can't select a port to start drawing a connector
|
Query |
Response |
|
when running the sample, all I get is the following:
I can't select a port to start drawing a connector. |
We have set port constraints ConnectOnDrag which activates the connection Tool when mouse hover on the port and you can draw the connector and establish the connection between two nodes. Please refer to the code example below.
Code example:
this.nodes = [
{
name: "firstNode", width: 100, height: 100, offsetX: 150, offsetY: 150,
ports: [
{name: "In", offset: { x: 0, y: 0.5 }, visibility: ej.datavisualization.Diagram.PortVisibility.Visible,constraints:ej.datavisualization.Diagram.PortConstraints.Connect | ej.datavisualization.Diagram.PortConstraints.ConnectOnDrag},
],
},
] |
|
thanks for the code - however I can't seem to get this working on my system - the `endPoint` property is always undefined. |
If you want to restrict the connections for an port, you can use connectionChange event to achieve your requirement. please refer to the code example for connectionChange event.
Code example:
//define connectionChange event
<ej-diagram id="diagramCore" (connectionChange)="connectionChange($event)">
</ej-diagram>
connectionChange(args){
//based on your condition cancel the event to restrict the connections for an port.
args.cancel = true;
}
In our previous update, we have checked args.endPoint condition only when you drag the connector in sourceEndPoint and targetEndPoint. So based on your usecase, you can code your own logic in the connectionChange event. |