Open lieyongchang opened 4 years ago
the demo is actually just missing code, will get onto that
TLDR; It works like that because by default DefaultLinkModel
is used for new link creation.
When you drag from port, engine fires an action: https://github.com/projectstorm/react-diagrams/blob/63dbe41df017db10212e93b22b282c0f3c363b1b/packages/react-diagrams-core/src/states/DragNewLinkState.ts#L48
Then from DefaultPortModel
it fires createLinkModel
method with creating instance of DefaultLinkModel()
https://github.com/projectstorm/react-diagrams/blob/63dbe41df017db10212e93b22b282c0f3c363b1b/packages/react-diagrams-defaults/src/port/DefaultPortModel.ts#L68-L74
You need to extend DefaultPortModel
with your own createLinkModel
implementation for returning PathFindingLinkModel
as default.
I am currently using react-diagram version: 6.2.0
Steps to reproduce:
Expected result: new link should be able to smart route Actual result: new link did not smart route
This is the demo I have been using as guide. Any advice to factor in run time smart routing is appreciated