Go js validation port shape vs main shape


#1

In gojs shape we can specify how many links we there can be from that shape (e.g. fromaxLinks: 2)

that is ok,
but in my case I have some a main shape , and 4 corner ports.

I want to start linking from the ports (and not from the main shape)
my validation is that from the shape will go only one link.

how can this be done?

the same thing is for the shape receiving a link, I need it to get only one link.


#2

If I understand your requirements correctly, you can just set GraphObject.fromMaxLinks and toMaxLinks on each of your port elements.


#3

this will be ok for each port,
but I still need the ports and the validation rules should effect the whole (main) shape


#4

Have you read https://gojs.net/latest/intro/validation.html ? You may need to specify a linkValidation predicate.


#5

Thank this did the trick